gettext
wouter@country:~/scratch/gettext$ cat > nl.po <<EOF
> msgid "foo"
> msgstr "foe"
> EOF
wouter@country:~/scratch/gettext$ msgfmt --statistics nl.po -o nl/LC_MESSAGES/foo.mo
1 translated message.
wouter@country:~/scratch/gettext$ LANG=nl.UTF-8 TEXTDOMAIN=foo TEXTDOMAINDIR=/home/wouter/scratch/gettext gettext -s 'foo'
foo
wouter@country:~/scratch/gettext$ LANG=nl_BE.UTF-8 TEXTDOMAIN=foo TEXTDOMAINDIR=/home/wouter/scratch/gettext gettext -s 'foo'
foe
wouter@country:~/scratch/gettext$
What's going on here? nl.UTF-8 doesn't exist in /etc/locale.gen. Since nl doesn't exist in /usr/share/i18n/locales either, adding it won't help (and creating a nl locale doesn't seem to make sense, as the differences between nl_BE and nl_NL are mostly in areas such as LC_TELEPHONE and LC_MONETARY, where a difference is correct). As a result, gettext doesn't find the correct locale environment and doesn't translate anything. It took me a while of looking at the locale definition files in /usr/share/i18n/locale to find out what's going on: the 'nl' directory isn't found because it happens to have a name which is part of the locale name; it is found because it happens to be referred from the locale definition. At least, that's what I think happens.
I didn't expect that. If gettext sees a locale name of nl_BE, which it does not know (because no charset is defined), it'll just pick a random charset which is defined, and use that. Isn't it reasonable to expect that the same will happen for stuff such as nl vs nl_BE?
Maybe that's a bug...