Is there some way in the Win32 API to convert a three letter language code, as returned by GetLocaleInfo() with LOCALE_SABBREVLANGNAME specified, to a corresponding LANGID or LCID? That is, going in “reverse” to what GetLocaleInfo() normally does?
What I’m trying to do is to parse what kind of language a resource DLL is using, and so far, without touching anything about the DLL, going by the dll name with a format nameLNG.dll, where LNG is a three letter language code, seems to be the easiest method, assuming such a function exists.
If this isn’t easy to do, I guess Plan B is to give our language DLL’s a version info resource, specify their respective cultures there, and later on in the application, read which cultures they use.
Unfortunately, there’s no direct Win32 API that gives you a LANGID given a 3-letters abbreviation.
It looks like CLanguageSupport is your friend today 🙂 It already implements your plan B to lookup the LANGID based on the contents of the version info resource.
The piece of code you’re looking for is int the function
Of course, the drawback is that you may have a mismatch between the version info and the DLL name. But you’d very quickly catch it during tests. And if you let a tool such as appTranslator create the DLLs for you, you’re sure to be on the safe side.