问题描述
我目前全球化经营我的应用程序。部分原因是正在与CultureInfo的和RegionInfo。有一个问题,真正让我为难。也许有人可以遮阳的一些情况如下:
I am currently dealing with globalization in my app. Part of it is working with CultureInfo and RegionInfo. There is one issue that really puzzles me. Maybe someone can shade some light on this:
var ci1 = new CultureInfo("de"); // Correct, gives a neutral CultureInfo
var ci2 = new CultureInfo("de-CH"); // Correct, gives a specific CultureInfo
var ci3 = new CultureInfo("fr-CH"); // Correct, gives a specific CultureInfo
var ci4 = new CultureInfo("no"); // Correct, gives a neutral CultureInfo
var ci5 = new CultureInfo("nb-NO"); // Correct, gives a specific CultureInfo
var ci6 = new CultureInfo("nn-NO"); // Correct, gives a specific CultureInfo
var ci7 = new CultureInfo("ch"); // Failure! Can't create a neutral Swiss culture.
这里的要点是,挪威和Swizerland都是多语言的国家,但与挪威我不能够创造一个中立的瑞士的CultureInfo。
The point here is, that Norway and Swizerland are both multilingual countries, but in contrast to Norway I am not able to create a neutral Swiss CultureInfo.
是,由于历史的原因,或者这只是在微软实现中的错误?
Is that because of historical reasons or is this simply a bug in Microsofts implementation?
编辑:看来,这是某种形式的政治问题,而不是技术。所以,我想改一下我的问题:任何好的想法如何处理这个问题在技术上?简单地忽略的 的CultureInfo(无) 的?有趣的是 的CultureInfo(无) 的提供了一个父的 CultureInfo.TwoLetterISOLanguageName 的NB的
It seems that this is some kind of 'political' issue, not a technical. So I would like to rephrase my question: Any good ideas how to deal with this issue technically? Simply ignore "CultureInfo("no")"? Interestingly enough "CultureInfo("no")" delivers a parent "CultureInfo.TwoLetterISOLanguageName" of 'nb'.
所以,对我来说是相当混乱。任何好的想法?
So, for me it is quite confusing. Any good ideas?
推荐答案
一个中立的文化是与一个的语言的,但不与国家/地区相关的文化。参见:http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo(v=vs.71).aspx
A neutral culture is a culture that is associated with a language but not with a country/region. See: http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo(v=vs.71).aspx
您正试图创建CH语言文化,但没有瑞士的语言。您可以使用DE-CH德语(语言) - 瑞士(国家)。同样的,你使用它-CH或FR-CH的意大利和法国(语言)在瑞士。
You are trying to create a language culture with ch, but there is no swiss language. You use de-CH for german (language) - switzerland (country). Similarly, you use it-CH or fr-CH for italian and french (languages) in switzerland.
和,作为MPelletier指出,没有加拿大的语言,但在加拿大地区,他们讲FR(附魔)或EN(中文)。
And, as MPelletier points out, there is no canadian language, but in the canadian region, they speak fr(ench) or en(glish).
这篇关于麻烦的CultureInfo挪威的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!