[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: languages lists



> Hello,
>
> I have written a Macro for our wiki, to automatically format and display
> the contributors' profiles ( http://wiki-debian-net.local/User/JohnDoe )
>
> I would like to Internationalize it, So I assume I should get the user
> to type it's language code (en, pt, pt_BR, zh_CN ...) rather than full
> text, so gettext has consistent inputs using. typically using:
> gettext(get_language_name(lang_code))
> BTW: what do you think about it? should I prompt for locale or iso636?

Hi Franklin,

if I understand correctly, it should make no big difference. The name of the 
locale (e.g. en_GB) is constructed from the ISO 639 language code, an 
underscore, and the ISO 3166 country code. So if you want to get the 
language code, you could either ask for the user's locale and take the first 
part before the underscore, or you could ask directly for the ISO 639 
language code. You should get the same result in both cases.

> Do you know a package which provides a locales->language name table?
> (the package iso-codes has such list, but only in it's source package
> notes/language-in-locales.txt)

Yes, correct. However, that file has not been updated for five years and is 
considered obsolete. We (the iso-codes package maintainers) are removing 
that file from the tarball. If you want to get a language name from the
ISO 639 code, try installing the package isoquery. Then you can run a 
command like that:

$ isoquery --iso=639 it
ita     ita     it      Italian

If you need only the language, you could pipe the above command through e.g. 
"cut -f4". Moreover, you can get translations for languages as well, try 
using

$ isoquery --iso=639 --locale=nl it
ita     ita     it      Italiaans

HTH,
Tobias

-- 
Tobias Quathamer | If God had really intended men to fly,
Hamburg, Germany | he'd make it easier to get to the airport.

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: