Skip to content
Muhammad Fahmi Rasyid edited this page Apr 3, 2020 · 2 revisions

After installing and loading th assembly, add namespace in the xaml

xmlns:rf="http://rasyidf.github.io/Localization"

all set, now you can implement Binding in any XAML like this:

Bind like this

<MenuItem Header="{rf:Tr File, Uid=11}"/>

Or this

<TextBlock Text="{rf:Tr Default='Default Hello World', Uid=11}"/>
<TextBlock Text="{rf:Tr FallBackText, Uid=12}"/>

Or this, with Format String

<TextBlock>
    <Run>
        <rf:Tr Uid="24" Default="Language : {0}, Count : {1} ">
            <Binding FallbackValue="en-US" Mode="OneWay"
                Path="CurrentLanguage" />
            <Binding FallbackValue="0" Mode="OneWay"
                Path="LanguageCount" />
        </rf:Tr>
    </Run>
</TextBlock>

in code, you can consume directly by using :

MessageBox.Show(LocalizationService.GetString("511", "Text", "Default Message"),LocalizationService.GetString("511", "Header","Default Title"));

another way is to use String extension. "[uid],[vid]".Localize("[Default]")

MessageBox.Show("511,Text".Localize("Default Message"),("511,Header").Localize("Default Title"));
Clone this wiki locally