Where is the list of available Windows locales?

11

1

If you open the Regional and Language Options (via Control Panel), and click on the Regional Options tab, then there is a drop down list of all the available locales.

Where is this list populated from?

(I want to compare the settings for each locale; I'm fine with how to do that, but I need a list of locale names to loop over.)


EDIT: After browsing through my windows directory (should probably mention I'm using XP), the file

C:\WINDOWS\system32\locale.nls

looks like a plausible candidate, but it's a binary file. Is this what I should be looking at, and if so, how do I read it?

Richard Cotton

Posted 2010-07-21T12:48:03.230

Reputation: 305

I ran into similar situation little while ago. Then I came to know that there is no direct to way to know the locales that are supported by Windows. I wrote a program to print all supported locale names under Windows. Here's link http://stackoverflow.com/questions/27614666/print-all-stdlocale-names-windows/27615711#27615711. I also have an executable if you want.

– user1 – 2015-01-09T04:11:37.217

Answers

9

Microsoft don't make it easy for you. The NLS file mentioned in the question does contain the locale information, but it's in HEX. Even with a hex editor, the contents are far from human readable. I decided to take an alternative strategy, inspired by r0ca's answer.

There is a more accurate list of available locales published by Microsoft. Unfortunately, even this list isn't quite right. (I installed all available locales, and I have Nothern Sotho, which isn't on Microsoft's list, but not Traditional Spanish, Modern Spanish or Macedonian. Ukranian is on the list twice.)

The names aren't quite right on the Microsoft list either.

In general, names should be of the form "Language" or "Language_Country Name", e.g. "English" or "English_United Kindom"

This means that underscores after the first must be replaced with spaces and that people names need to be replaced with country names, e.g. "Malay_Brunei_Darussalam" becomes "Malay_Brunei Darussalam" "Dutch_Belgian" becomes "Dutch_Belgium"

There are lots of other oddities. Latin, Cyrillic and some other words need to be bracketted, e.g. "Serbian_Cyrillic_Bosnia_Herzegovina" becomes "Serbian (Cyrillic)_Bosnia and Herzegovina"

Likewise "Sami_Inari" becomes "Sami (Inari)_Finland"

There are many more examples of having to guess proper country names "English_Philippines" becomes "English_Republic of the Philippines"

I figured most of these exceptions out by changing my Windows locale from the control panel, then loading up R and typing

Sys.getlocale()

Unfortunately, this method doesn't currently work with the Indian locales (plus a few others). See bug report here.

Richard Cotton

Posted 2010-07-21T12:48:03.230

Reputation: 305

4

You have them all listed here. I hope this is what you are looking for

r0ca

Posted 2010-07-21T12:48:03.230

Reputation: 5 474

Thanks, although I really want the list of which languages are available on my system. For example, I don't have Chinese installed, but I do have Northern Sotho (which wasn't on the list). (Go figure about those options...) The point is that Windows must store a list of what is installed somewhere; I just can't find it. – Richard Cotton – 2010-07-21T13:22:51.493

Still trying to get this .nls file reader working... Damn it! – r0ca – 2010-07-21T20:42:41.323

Thanks for your persistence. It seems that the latest version of Gudu Software's NLS reader is corrupt. I've emailed them to tell them, so we'll have to wait and see. – Richard Cotton – 2010-07-22T14:16:10.430

Yhea, I had the same but I didn't email. Also tried from several mirror but... no luck! – r0ca – 2010-07-23T12:42:21.057