Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trouble with CultureInfo for Norway

Tags:

c#

.net

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.

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?

EDIT: 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?

like image 979
Andreas Avatar asked Oct 31 '12 14:10

Andreas


People also ask

What is CultureInfo?

The CultureInfo class provides culture-specific information, such as the language, sublanguage, country/region, calendar, and conventions associated with a particular culture. This class also provides access to culture-specific instances of the DateTimeFormatInfo, NumberFormatInfo, CompareInfo, and TextInfo objects.

What is CultureInfo CurrentCulture?

The CultureInfo. CurrentCulture property is a per-thread setting; that is, each thread can have its own culture. You get the culture of the current thread by retrieving the value of the CultureInfo. CurrentCulture property, as the following example illustrates. C# Copy.


3 Answers

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

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.

And, as MPelletier points out, there is no canadian language, but in the canadian region, they speak fr(ench) or en(glish).

like image 175
mcalex Avatar answered Oct 28 '22 04:10

mcalex


"no" has different behavior from "ch", because "no" is a language, norwegian, while "ch" does not refer to any language.

While it's correct that Norway is a multilingual country the official languages in Norway are; Norwegian, Sami and Kven. With Sami and Kven recognised as minority languages. Neither "nb" or "nn" refers to languages that have offical recognizion in Norway, because neither bokmål or nynorsk are languages.

The confusion stems from two facts. Norwegian, unlike most languages, has two offical written norms, Bokmål and Nynorsk. In ISO 639 Norwegian is considered a macro language for the two norms and ISO 639 assigns a separate language code to the two written norms, ie. "nb" and "nn". And the language code for Norwegian "no" coincides with the country code for Norway "NO".

like image 40
Taemyr Avatar answered Oct 28 '22 03:10

Taemyr


According to ISO language standard there is nno nn Norwegian Nynorsk; nob nb Bokmål, Norwegian; nor no Norwegian

From Wikipedia "https://en.wikipedia.org/wiki/Norwegian_language" Nynorsk and Bokmål provide standards for how to write Norwegian, but not for how to speak the language. There is no officially sanctioned standard of spoken Norwegian, and most Norwegians speak their own dialects in all circumstances. Thus, unlike in many other countries, the use of any Norwegian dialect, whether it coincides with the written norms or not, is accepted as correct spoken Norwegian.

no is spoken Norwegian nn and nb are written forms

on a website if you see no-no you can assume it is nb-no.

like image 45
plafond Avatar answered Oct 28 '22 03:10

plafond