Localization on the fly in WinRT app

Viewed 1990

In WinRT app newer localization is applied when app is restarted (using code or by changing language from control panel). What to do if I want to change the localized strings on-the-fly, without restarting the app?

Suppose I have combo box with different languages. If user selects any language, all the strings would be translated using resource.

I came across this code, but it works only if I put it in App constructor, that's also on launch only. I can't make it a static method as it doesn't work.

var culture = new System.Globalization.CultureInfo("en-US");
Windows.Globalization.ApplicationLanguages.PrimaryLanguageOverride = culture.Name;
System.Globalization.CultureInfo.DefaultThreadCurrentCulture = culture;
System.Globalization.CultureInfo.DefaultThreadCurrentUICulture = culture;

I want something like below given image. Image is from CodeProject article.

enter image description here

2 Answers
Related