13

I need a list of cultures that are supported by .NET 3.5, regardless of the OS used. This seems to be quite a struggle to obtain, though I am not sure why!

Edit: Arghh, I was not aware that it is dependent on the OS, that would explain the lack of documentation. Any ideas on what is supported by Mac/Linux OS as well?

Thanks :)

Yacoby
  • 54,544
  • 15
  • 116
  • 120
Fiona - myaccessible.website
  • 14,481
  • 16
  • 82
  • 117
  • Out of curiosity, why do you need the list? – OregonGhost Feb 17 '10 at 17:02
  • Just to work out what langauges we will have to create custom cultures for and what we can use 'out of the box'. For example, I was recently asked whether Welsh is supported. – Fiona - myaccessible.website Feb 17 '10 at 17:12
  • Don't forget that what CultureInfo supplies is basically just a few strings (name in three languages, ISO codes, currency name) and the date and number formatting. The latter doesn't require specialized cultures in most cases, since they're the same for most related cultures (i.e. most European countries have the same number formatting). So the question is, do you need a Welsh culture, or do you just need Welsh translations? By the way, while that won't solve your general problem, cy-GB is available in CultureInfo as a specific culture. Someone asking for Welsh support will likely have a... – OregonGhost Feb 18 '10 at 09:12
  • ... computer that has Welsh support installed, or is at least from a related region. As already said, it's unfortunate not to have Culture Explorer 2.0 available anymore... – OregonGhost Feb 18 '10 at 09:12
  • 1
    I found Culture Explorer 2.0 in all its glory on [Waybach Machine](http://web.archive.org/web/20070218132812/http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=b778ff2c-9142-4769-839a-094f51a6f9f4)! – Cristian Diaconescu Jan 31 '13 at 12:02

4 Answers4

8

Unfortunately, it is OS dependent. Check here for default language support per OS.

Note, the CultureInfo documentation warns:

Windows versions or service packs can change the available cultures.

In ASP.NET, it's the browser that's important versus the OS. It can tell you which language the user prefers via the Accept-Language (Section 14.4) request header. If you set your app's globalization configuration to enableClientBasedCulture="true", ASP.NET will try to automatically set the UICulture and Culture to the value provided by the browser. Alternatively, you can set Culture manually by inspecting the Request.UserLanguages property:

Unfortunately, there's no way to generate an exhaustive list of possible languages from an OS or browser. The closest thing is the IANA Language Subtag Registry. This is the language registry described in RFC 4646 - the document that defines .NET's CultureInfo tags.

Keep in mind, language tags in Request.UserLanguages are not guaranteed to be valid. You'll want to check them. HTTP 1.1 uses an older recommendation for language tags and there's nothing stopping someone from sending gibberish in the language header.

Corbin March
  • 25,526
  • 6
  • 73
  • 100
4

National Language Support (NLS) API Reference lists locale information and allows you to select the OS.

Microsoft Locale Builder is a tool to create custom locales for Windows Vista and later.

Get a list of supported cultures, including custom ones, for the OS.

C# Example,

System.Globalization.CultureInfo[] cultures = System.Globalization.CultureInfo.GetCultures(System.Globalization.CultureTypes.AllCultures);
Doug Domeny
  • 4,410
  • 2
  • 33
  • 49
1

It is possible to create custom cultures, but the default class supports those cultures provided by the operating system you're running on. There is a reference of the cultures supported by default on MSDN

Rowland Shaw
  • 37,700
  • 14
  • 97
  • 166
0

I just checked with Culture Explorer 2.0, there is a distinction between Windows-only cultures and installed cultures, as well as .NET Framework cultures (which, at least on my system, only contain language-only cultures). All of these are supported by the CultureInfo class (and RegionInfo, NumberFormatInfo and so on).

I also ran it on Mono (on Linux), it's roughly the same, with the .NET Framework cultures and the Windows-Only cultures missing, but the Specific and Neutral cultures are there. RegionInfo.CurrencyNativeName seems not to be implemented in my Mono version though, so it crashes when selecting any culture.

Unfortunately, Culture Explorer 2.0 is currently not available from anywhere (was on gotdotnet.com), I downloaded it some time ago. It's a handy tool for such things. You may have luck to find one in some archives.

OregonGhost
  • 23,359
  • 7
  • 71
  • 108
  • http://www.microsoft.com/middleeast/arabicdev/DevTools/VSdotNET/samples/CultureExplorer.aspx – erikkallen Feb 17 '10 at 20:53
  • @erikkallen: That's the first version of the tool. It doesn't have all the categories and only supports .NET Invariant country, specific language cultures. I don't know about the license of Culture Explorer 2.0 - maybe I can later upload it to CodePlex. – OregonGhost Feb 18 '10 at 09:05
  • 2
    I found Culture Explorer 2.0 in all its glory on [Waybach Machine](http://web.archive.org/web/20070218132812/http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=b778ff2c-9142-4769-839a-094f51a6f9f4)! – Cristian Diaconescu Jan 31 '13 at 11:58