NO doesn't mean maybe, and it certainly doesn't means NB!

by Michael S. Kaplan, published on 2007/12/19 10:16 -05:00, original URI: http://blogs.msdn.com/b/michkap/archive/2007/12/19/6792635.aspx


I was going to run the title by some people since it seems like it might be mildly offensive, though one of the side effects of my little Cerebus-esque1 vacation is that I couldn't bounce it off anyone. So if you are offended then I apologize as it seems that when cut off from people I lose my moral compass?

Many people who are looking for shortcuts will often pick methods that usually work.

Of course that's just fine until suddenly the underlying principle behind usually kicks in, by which I mean that usually isn't always.

Like the way people see how the Names of CultureInfos seem to be supersets of the Names of the Parents.

So rather than creating objects to get the resource fallbacks, they use simple string parsing to get what they want.

But then guess what happens?

Well, let's just run some code and test the theory here:

using System;
using System.Globalization

public class Test {
    public static void Main() {
        foreach(CultureInfo ci in CultureInfo.GetCultures(CultureTypes.SpecificCultures)) {
            if(! ci.Name.StartsWith(ci.Parent.Name, StringComparison.OrdinalIgnoreCase)) {
                Console.WriteLine("'{0}' is hardly a subset of {1}.", ci.Parent.Name, ci.Name);
            }
        }
    }
}

the output if you compile this code?

'zh-CHT' is hardly a subset of zh-TW.
'no' is hardly a subset of nb-NO.
'zh-CHS' is hardly a subset of zh-CN.
'no' is hardly a subset of nn-NO.
'zh-CHT' is hardly a subset of zh-HK.
'zh-CHS' is hardly a subset of zh-SG.
'zh-CHT' is hardly a subset of zh-MO.

Alright, we'll leave those five Chinese entries alone, I talked about them enough already in this blog. Though it is worth noting that even if the whole hant/hans things hadn't been screwed up, all five will still be problem since none of them were named with that hant/hans thing in there....

But those other two entries -- nb-NO for Norwegian - Norway (Bokmål) and nn-NO for Norwegian - Norway (Nynorsk) -- unfortunately there's no way to fix this one up without completely splitting them and giving them different neutrals, since all varieties of the ISO-639 codes split them.

And that would break compatibility with the fact that their LCID values both share the same PRIMARYLANGID (LANG_NORWEGIAN).

Come to think of it, part of the Chinese problem (the one I said I wouldn't talk about but that keeps coming up!) is also due to the fact that all five LCID values share the same PRIMARYLANGID (LANG_CHINESE).

So when you get down to it, I could actually get away from the obnoxious oblique "No Means NO" date rape reference in the title and just remind everyone how much LCIDs suck and LANGIDs suck more and make my point with a tad more political correctness.

Too bad I'm to lazy to rewrite the post....

 

1 - When I Cerebus-esque I refer to David Sim's misanthropic three-foot tall bipedal gray aardvark Cerberus who is described as an amoral character, at times sympathetic, at others unpalatably callous. (ref: Cerebus). I admit my sympathies for the Kevillists (the daughters) though if I ever were to have children I'd probably find them to be more in line with the Cirinists (the mothers). Men, I'd tolerate, which gives lie to the misanthropic notions I started this note with, though I don't feel top plagued by consistency at this hour. :-)

 

This post brought to you by(U+13c3, aka CHEROKEE LETTER NO, symbolically suggesting to some that NO means the end [of the alphabet])


no comments

referenced by

2007/12/22 CultureInfo subsetting attempts that suck

go to newer or older post, or back to index or month or day