Jacob
Jacob

Reputation: 1262

Microsoft sublanguage string to locale identifier

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

Upvotes: 1

Views: 1010

Answers (1)

Franci Penov
Franci Penov

Reputation: 76001

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.

Upvotes: 2

Related Questions