本以為跟國際化無緣,不在軟件的考慮范圍內(nèi),沒想到偶爾一個(gè)項(xiàng)目還是繞不開,小記一下
System.Globalization.CultureInfo.InstalledUICulture.Name? ? ? ?這是獲得英文的區(qū)域碼,也就是zh-cn的這種,需要找區(qū)域碼字典對(duì)照。
System.Globalization.CultureInfo.InstalledUICulture.NativeName? ? ?區(qū)域碼對(duì)應(yīng)的名稱,如:中文(中國)
int lcid = System.Globalization.CultureInfo.CurrentCulture.LCID;? ? ??得到語言的lcid;
int lcid = System.Globalization.CultureInfo.CurrentCulture.LCID; //string nam = System.Globalization.CultureInfo.InstalledUICulture.Name; //string nam2 = System.Globalization.CultureInfo.InstalledUICulture.NativeName; if (lcid == 0x804 || lcid == 0xc04 || lcid == 0x1404 || lcid==0x1004 || lcid == 0x404)//中文、中文香港、中文澳門、中文新加坡、中文臺(tái)灣 { XXX.Chinese; } ///英語 ///英語-澳大利亞 ///英語-伯利茲 ///英語-加拿大 ///英語-加比勒 ///英語-愛爾蘭 ///英語-牙買加 ///英語-新西蘭 ///英語-菲律賓 ///英語-南非 ///英語-特立尼達(dá)和多巴哥 ///英語-英國 ///英語-美國 ///英語-津巴布韋 if(lcid ==0x0009 || lcid ==0x0C09 || lcid ==0x2809 || lcid ==0x1009 || lcid == 0x2409|| lcid ==0x1809 || lcid ==0x2009 ||lcid ==0x1409 || lcid ==0x3409 ||lcid ==0x1c09 ||lcid ==0x2c09 ||lcid ==0x0809 || lcid ==0x0409 ||lcid ==0x3009) { XXX.English; }
微軟國家語言代碼表 – Language Locale ID LCID 對(duì)應(yīng)表
文章來源:http://www.zghlxwxcb.cn/news/detail-711694.html
?文章來源地址http://www.zghlxwxcb.cn/news/detail-711694.html
到了這里,關(guān)于軟件國際化的問題 C#得到當(dāng)前windows系統(tǒng)的語言版本的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!