Sorting it all Out Michael Kaplan's random stuff of dubious value Be sure to read the disclaimer here first!
Late last week, there was a bug in some builds of Vista where one of the language names in Regional and Language Options and the Input Languages dialogs were apparently being duplicated. I was working with my manager to fix a different issue and for a while we thought it might be related to the fix we were working on. After establishing it wasn't us, we decided a separate bug should probably just be reported....
Then on Saturday I was doing a review for a bug fix someone else was doing for a separate bug, which happened to be the cause of the very duplicated name problem we had seen. It all came toegther.
And then just yesterday, Serge Wautier asked me in the Suggestion Box:
Hi Michael, Why does GetLocaleInfo(...,LOCALE_SLANGUAGE,...) include the country name when the sublanguage is not unique ? After all, there is LOCALE_SCOUNTRY for the ones who want. Also, LOCALE_SENGLANGUAGE does not include the country name, apparently making it kind of inconsistent with its non-ENG pal. How do I retrieve the localized name of a language without the country ? Friendly, Serge.
Hi Michael,
Why does GetLocaleInfo(...,LOCALE_SLANGUAGE,...) include the country name when the sublanguage is not unique ? After all, there is LOCALE_SCOUNTRY for the ones who want.
Also, LOCALE_SENGLANGUAGE does not include the country name, apparently making it kind of inconsistent with its non-ENG pal.
How do I retrieve the localized name of a language without the country ?
Friendly,
Serge.
And yes, this is related!
Let's take a look at all of the different language and country names here. First the managed:
And here is the unmanaged, all coming from GetLocaleInfo and some of its LCType values:
A few important conclusions that can be drawn from contrasting these two lists and adding some additional information:
As in most cases, the needs of a particular customer scenario outweight the need to be consistent at the potential cost to usability, thus this long standing difference in LOCALE_SLANGUAGE has been there for quite some time.
For the .NET Framework, the separate language name without region can of course be found by using the neutral CultureInfo object rather than the specific one, an option that Windows has never had....
In an odd way, this difference reveals something about the nature of how the two functionality was created on the two platforms. The Windows platform had that locale information added item by item, as it was required for other functionality in NLS or other parts of Windows -- sometimes consistent and sometimes not (for both the names of the various constants and what they return).
The .NET Framework, on the other hand, had the advantage of being able to look at the over 200 data items and build up a consistent model for the bulk of them. So it has a very cool advantage in that respect....
I suspect over time as items are added to the .NET Framework based on customer requests that it may lose some of that advantage -- once the scenarios start to overtake all of that careful planning.
That bug? It was a case where a new locale was added and both LOCALE_SLANGUAGE values were the same since the regions were not there. But the bug has been fixed and Serge's question has been answered and all is well. :-)
This post brought to you by "ޗ" (U+0797, THAANA LETTER CHAVIYANI)
Way back near the end of 2005 in What's up with the language names? , I went through the many different
(If you can tell what CD is playing over here in the background right now, be sure to give yourself two
You may have noticed Windows locales cart around a lot of languages.
I talked about this a bit in