Benjamin Kampmann wrote:
Hi overthere.

Am Mittwoch, den 03.10.2007, 12:26 +0000 schrieb Jonas Borgström:
True, it's up to you to decide if the benefits are enough to add an
additional dependency. As I said before I just wanted to make sure you
were aware of Babel and the additional benefits it provides compared to
the gettext+locale python modules.

Okay. We are aware of the project and as you already said, it wouldn't
make that much work for us to change it. But before I NEED to know, if
it is able to use the 3-letter code (because as far as I can see, there
is only the LANG-Code thing).

But let's get to the more interesting part:

Well, I have no idea what the gettext language code would be for
prussian, but I'm sure there is one. The language_TERRITORY convention
used by GNU gettext does not always use 2-letter codes (ISO-639). For
more rarely used languages a 3-letter code (ISO-639-2) code is used
instead. So as far as I can tell this convention also covers all
languages. Another important detail is that this convention also allows
a TERRITORY to be specified, which is very important to be able to
determine which locale data to use.

As you can simply see here:
http://www.sil.org/iso639-3/codes.asp?order=reference_name&letter=p

there is no other language-code than the one specified in ISO-639-3 for
prussian. The 3-Letter-codes which are used in language_territory are
specified in ISO-639-2. Just take a look at that page and you'll see,
that there are big differences between these different ISOs. But maybe
this simple counter can convince you:
ISO-639-1 has about 180 codes
ISO-639-2 has about 450 codes
ISO-639-3 has about 6900 codes

Ok, I didn't know that ISO-639-3 contained even more languages. But I still think unless there is a strong need to support some really obscure language right now the project is better of using the convention used by most OSS project for now (GNU, GNOME etc..). I'm sure someone will eventually figure out how to extend the current convention to support language 451-6900 if there is indeed not supported already.



http://www.gnu.org/software/gettext/manual/html_node/Language-Codes.html
 Another thing. Wouldn't the use of 3-letter codes force you to have to
maintain some kind of translation table between 3-letter codes and the
language_TERRITORY convention used by the operating system in order to
set the locale and to detect the locale and language used by the
operating system?
Yes. I also don't like that, too. Of course. But we only do this for the
main-languages. Because we can't figure out the best iso-3 code from the
lang_territory code, we only use the first 'lang' part and try to figure
out, what the equal one in iso-3 is.

I guess. That was a good argument. I've already thought, that there are
a lot of discussions about this. That is absolutely normal because this
ISO is really jung (Feb 07) but I'm sure that is going to be the one for
us and the one for the future use. So my question again: is babel able
to handle the 3-letter codes?


Sure. Message catalogs can be loaded individually. But the high-level api assumes that a standard "locale/language_TERRITORY/LC_MESSAGES/domain.mo" directory structure is used. The gettext module is actually used by Babel internally for this stuff anyway...

But keep in mind that this only provides a message catalog. To get access to the CLDR locale database
a language id is not enough, you need to know the territory as well.

A sneak preview :)

import babel
babel.Locale('de_DE').languages['sv']
u'Schwedisch'
babel.Locale('de_DE').languages['nai']
u'Indianersprachen, Nordamerika (Andere)'

Cheers,
Jonas

Reply via email to