本文介紹了如何在 Windows Phone 上更改 C# 中的本地化?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
我有 2 種語言的資源文件,我的應(yīng)用程序已經(jīng)讀取其中一種語言的值.我希望能夠在 C# 中更改我的應(yīng)用程序的語言(使用其他資源文件),而不是在設(shè)置中更改整個(gè)手機(jī)的語言.
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?
推薦答案
在App.xaml.cs
中,在InitializePhoneApplication
方法中:
private void InitializePhoneApplication()
{
Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR");
Thread.CurrentThread.CurrentUICulture = Thread.CurrentThread.CurrentCulture;
.......
}
限制是需要在app初始化中,所以如果用戶改變語言,需要重啟才能生效.
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.
這篇關(guān)于如何在 Windows Phone 上更改 C# 中的本地化?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!