views:

31

answers:

1

I can't seem to find a way to convert, or find, a local identifier from a sublanguage string. This site shows the mappings:

http://msdn.microsoft.com/en-us/library/dd318693(v=VS.85).aspx

I want the user to enter a sublanguage string, such as "France (FR)" and to get the local identifier from this, which in this case would be 0x0484. Or the other way around, if a user enters 0x0480 then to return French (FR).

Has anyone encountered this problem before and can point me in the right direction?

Otherwise I'm going to be writing a few mapping statements to hard code it and maintain future releases if anything changes.

BTW, I'm coding in C++ for Windows platform. Cheers

+1  A: 

A good starting point would be the LCIDToLocaleName function and it's opposite - LocaleNameToLCID. Note that these allow converting between LCID and RFC4646 locale name; to get the humanreadable country and language names, use the GetLocaleInfoEx with the LOCALE_SENGLISH* flags. If you need localized names instead of English, use LOCALE_SLOCALIZED* constants instead.

Franci Penov
+1 thanks, I have crossed that one but I'm looking for something a little more human readable. Some of those RFC4646 codes are harder than remembering the 4 char hexidecimal LCIDs, haha. If I can't find a more suitable answer soon, all mark you correct :)
Jacob
I'll give you this one because you started me in the right direction. I posted the bare bones of the code I actually used in by blog > http://corner1001.wordpress.com/2010/07/02/windows-system-languages/ so I hope it can help others
Jacob