Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I change localization in C# on Windows Phone?

I have my Resource files with 2 languages and my app already reads the values of one of them. I would like to be able to change the language of my app (use the other resource file) in C# instead of changing the language of the whole phone in Settings.

Is this possible? If so, how?

like image 309
GabCas Avatar asked Feb 26 '13 16:02

GabCas


1 Answers

In App.xaml.cs, in the InitializePhoneApplication method:

private void InitializePhoneApplication()
{
    Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR");
    Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
    .......
}

The limitation is that it needs to be in the app initialization, so if the user changes the language, a restart will be required for it to take effect.

like image 177
Olivier Payen Avatar answered Oct 11 '22 18:10

Olivier Payen