Sdílet prostřednictvím


Oh, the enumeration!

Note (10/3/06): This post contains outdated content. For the correction, please see the update in Oh, the enumeration? Part two.  

If you use EnumSystemLocales(), one thing you may have noticed in Vista is that the Spanish Traditional sort locale (040a) is no longer included in our enumeration. The locale still exists, so you can ask for it specifically by LCID. But it is no longer enumerated in Vista. So if your code has some dependency on returning the locale in enumeration -- say, if you're enumerating all the locales on the system and relying on the returns from XP pushing forward onto Vista -- you'll want to be mindful of the change.

Note that you can still return this locale in our Vista enumeration function by passing the LCID_ALTERNATE_SORTS flag. If you pass this flag, you will return the Traditional sort Spanish locale as well as all other alternate sort locales available in Vista.

Why did we make this change? Good question.

When we first introduced the Traditional sort locale for Spanish, we made it identical to the locale for Spanish - Spain in all respects but two. First, the two locales used different sorting behavior, as their descriptions would indicate. At the time, we did not realize that we would find other locales that might require the support of multiple sorting standards or behaviors, so we introduced another key difference between the Spanish - Spain locale and the Traditional sort Spanish locale: the two locales share a primary lang ID, but they have different LCIDs.

In retrospect, in light of the many other alternate sort locales for which we have added support, this was not the right design call. Our model for other alternate sort locales is that they actually share all locale data programmatically with the locales on which they are based; the only difference is found in the sorting behavior itself.

Because the Traditional sort Spanish locale is more properly considered an alternate sort variant of the Spanish - Spain locale rather than a full-fledged locale with its own independently defined data, moving forward we would like to treat it like the other alternate sort locales that we support. We wanted to minimize the breaking nature of the change, so we are committed to continuing to support the locale if it is specifically asked for by LCID. However, we also wanted our Vista enumeration behavior to accurately reflect the true nature of the locale. Hence it is available when people enumerate asking for alternate sort locales, but it is not returned by a call to EnumSystemLocales without the LCID_ALTERNATE_SORTS flag.

Comments

  • Anonymous
    September 26, 2006
    I figured someone would have a politer version of this issue posted. Ah, the humanity!