Gab*_*Cas 12 c# localization windows-phone
我有2种语言的资源文件,我的应用程序已经读取其中一种语言的值.我希望能够在C#中更改我的应用程序的语言(使用其他资源文件),而不是在"设置"中更改整个手机的语言.
这可能吗?如果是这样,怎么样?
在App.xaml.cs,InitializePhoneApplication方法中:
private void InitializePhoneApplication()
{
Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR");
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
.......
}
Run Code Online (Sandbox Code Playgroud)
限制是它需要在应用程序初始化中,因此如果用户更改语言,则需要重新启动才能使其生效.