For testing purpose, I'm trying to localize a dummy application, in order to see what match the best our needs.
I wanted to try WPF Localization Extension.
So I :
Created a whole new WPF application, created a main windows.
Added the references to WPF Localization Extension through nugget.
Created one resx named
Localization.resx
and oneLocalization.fr.resx
I Added in both resx a text for the "WelcomeText" key.
In main windows, I put:
xmlns:lex="http://wpflocalizeextension.codeplex.com" lex:LocalizeDictionary.DesignCulture="en" lex:ResxLocalizationProvider.DefaultAssembly="LocalizedApplication" lex:ResxLocalizationProvider.DefaultDictionary="Localization"
In the Window declaration
I added one
TextBlock
within the grid:<TextBlock Text="{lex:Loc WelcomeText}" />
If I run the application, I've the text displayed in english.
Now I add the following in the App.cs constructor:
public App():base()
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr");
Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture;
CultureInfo.DefaultThreadCurrentCulture = Thread.CurrentThread.CurrentUICulture;
CultureInfo.DefaultThreadCurrentUICulture = Thread.CurrentThread.CurrentUICulture;
}
To test the application in FR. I rebuild and restart, but I still get the message in english.
So first: What did I do wrong? Then: How should I change the current culture at runtime?