Change the culture when application runs.
Hi all,
I’m very very new in C#/WPF world, but this fascinates me more and more. Now I must find a way how our future application will use the localization / globalization. I did all the steps I found in MSDN to create this (UID, LocBaml, satellite, etc.) and I it works perfect (a little bit complicated but anyway it works). The application starts in the OS culture starts, also if I put at the beginning this code:
public App()
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo("de-DE");
//Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
}
It works perfect.
Now I try (and I spent too much time for this issue) to change the culture online, when the application runs. Something like:
private void CheckLanguage(object sender, RoutedEventArgs e)
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo((german) ? "de-DE" : "en-US", true);
}
When the user clicks a button to change from german to English. I guess I’m too naive to believe that, but I don’t know what should I write so to get my current main window show all stuff in other language?
For any idea thank you in advance!
Best regards,
Emanuil
Re: Change the culture when application runs.
Haven't verified this, so take it with a chunk of salt, but I'd say you probably have to recreate your windows (and then, of course, get them back to the same state...judicious use of the Memento pattern could help).