[Tutor] How to find language name

Michael Lange klappnase at freenet.de
Tue Oct 26 12:49:33 CEST 2004


On Tue, 26 Oct 2004 12:53:38 +1300
Liam Clarke <cyresse at gmail.com> wrote:

Hi Liam,

thanks for the reply

> Hi Michael,
> 
> quoted from docs ---
> To maintain compatibility with other platforms, not only the LANG
> variable is tested, but a list of variables given as envvars
> parameter. The first found to be defined will be used. envvars
> defaults to the search path used in GNU gettext; it must always
> contain the variable name "LANG". The GNU gettext search path contains
> 'LANGUAGE', 'LC_ALL', 'LC_CTYPE', and 'LANG', in that order.
> 
> 
> Unless I'm wrong, and someone will let me know very shortly if I am;
> the returned tuple from  getdefaultlocale will always be (language
> code, encoding)
> 

That's what had confused me, like I wrote in my first post, I get:

>>> import locale
>>> locale.getdefaultlocale()
['de_DE', 'de']

Thanks for pointing me to the search order, this lead me to try:

[pingu at localhost pingu]$ echo $LANGUAGE
de_DE:de

so that's obviously where my getdefaultlocale() result comes from.
Maybe that's a special Mandrake goodie, now it looks to me what I
need is rather getdefaultlocale()[0][:2].

Best regards

Michael





More information about the Tutor mailing list