ニュートラルカルチャ名から任意の特定のカルチャ名を得る
ニュートラルカルチャ名から任意の特定のカルチャ名を得るにはCultureInfo.TextInfo.CultureNameを見ればよい。
例えば英語(en)ならアメリカ英語(en-US)、日本(ja)なら日本語(ja-JP)を取得するというもの。
The CultureName property always reflects a specific culture rather than a neutral culture. If CultureInfo.Name has a neutral culture as its value, then the corresponding CultureName has as its value an arbitrary specific culture that uses the same language.
http://msdn.microsoft.com/en-us/library/system.globalization.textinfo.culturename%28v=vs.100%29.aspx
この機能がMono Frameworkではまだ実装されていなかった。
System.Diagnostics.Debug.WriteLine((new System.Globalization.CultureInfo("en")).TextInfo.CultureName); // -> "en-US" System.Console.WriteLine((new System.Globalization.CultureInfo("en")).TextInfo.CultureName); // -> System.ArgumentException: Region ID 9 (0x0009) is not a supported region.
以前、Mono FrameworkでニュートラルカルチャなCultureInfoクラスはインスタンス化できなかったが最近になってできるようになった。しかしまだ対応できていない所があるようだ。