UWP 多語言的三個概念
首先了解一下 RFC4646 和 BCP-47 是什么東西:
RFC4646
The name is a combination of an ISO 639 two-letter lowercase culture code associated with a language and an ISO 3166 two-letter uppercase subculture code associated with a country or region.(所謂 RFC4646 是定義了語言標(biāo)簽的一套標(biāo)準(zhǔn),在這個標(biāo)準(zhǔn)下,每一個語言標(biāo)簽由一個兩個小寫字母的語言標(biāo)簽和一個兩個大寫字母的國家/區(qū)域的國際域名縮寫構(gòu)成)
BCP-47
所謂 BCP-47 也是定義了語言標(biāo)簽的一套標(biāo)準(zhǔn).
Note that this file is a concatenation of more than one RFC.(BCP-47 包含多個 RPC 文檔)
This document replaces [RFC4646]. This document, in combination with [RFC4647], comprises BCP 47.(BCP-47 是由 RFC4646 和 RFC4747構(gòu)成)
目前在 Windows 10中,.net framework4 及以后的.net framework 均支持 BCP-47。 UWP 表示多語言都用 BCP-47 中定義的標(biāo)簽。
在 Windows 10 和 UWP 中,關(guān)于多語言由三個概念:
1.用戶語言列表(user profile language list):
可以使用如下接口獲取,在Windows10中,實際就是設(shè)置中區(qū)域和語言里面的首選語言列表
Windows.System.UserProfile.GlobalizationPreferences.Languages
2.應(yīng)用程序語言列表(App manifest language list):
開發(fā)UWP程序的時候,如果要支持多語言,就需要在配置文件中聲明需要支持什么語言,在運行時,可以通過如下接口獲取當(dāng)前應(yīng)用支持什么語言:
Windows.Globalization.ApplicationLanguages.ManifestLanguages
值得注意的是,我們要聲明多種語言,可以自動聲明,也可以自己手動添加。
3.運行時語言列表(App runtime language list):
在程序運行時,可通過如下接口獲取,簡單來說,所謂運行時語言列表,就是 1 和 2 中兩種列表的交集,細(xì)微上還有點區(qū)別,可以參考最后的鏈接。
Windows.ApplicationModel.Resources.Core.ResourceContext.GetForCurrentView().Languages;
Windows.Globalization.ApplicationLanguages.Languages;
參考 doc.microsoft.com:
Understand user profile languages and app manifest languages

浙公網(wǎng)安備 33010602011771號