Quantcast
Channel: WPF Localization Extension
Viewing all articles
Browse latest Browse all 286

New Post: GetUIString in ModelView using default Assembly and Dictionary

$
0
0
Hi!

I set the DefaultAssembly and DefaultDictionary in my MainWindow:
lex:ResxLocalizationProvider.DefaultAssembly="Internationalisation"
lex:ResxLocalizationProvider.DefaultDictionary="Translation"
In all usercontrols I can call the LocText like this (without setting assembly and dictionary:
<TextBlock Text="{lex:LocText TextTranslated}" />
So I would expect that I could use the same notation in ViewModel (not code behind):
GetUIString("TextTranslated");
but it doesn"t seem to work. Nevertheless it works well if I set all the "path":
GetUIString("Internationalisation:Translation:TextTranslatedBinding");
Note that my GetUIString is like this:
public string GetUIString(string key)
{
    string uiString = string.Empty;
    LocExtension locExtension = new LocExtension(key);
    locExtension.ResolveLocalizedValue(out uiString);
    return uiString;
}
Am I doing something wrong? Or this default assembly and dictionary is only available in xaml? That would be great if ResolveLocalizedValue search for the default assembly and dictionary using maybe the static class ResxLocalizationProvider.




I have another minor issue (not important since is only for design time):
If I set this DesignCulture it doesn't work:
lex:LocalizeDictionary.DesignCulture="fr-FR"
Althought it works well if I set:
lex:LocalizeDictionary.DesignCulture="en"
Thank you in advance!
Fábio

Viewing all articles
Browse latest Browse all 286

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>