[Stani, I've attached a patch for this bug, below I explain why I think it's right]
Emmanuel Hainry wrote: > Package: phatch > Version: 0.1.6-1 > Severity: normal > > > Although I set my locales to speak in english but use french > conventions: > Locale: LANG=en_GB.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8) > phatch speaks in french. Launching it as > LC_CTYPE=en_GB.UTF-8 phatch > makes it speak in the right language however. Phatch sets the locale at core/config.py, load_locale function, which uses the locale python module: locale.setlocale(locale.LC_ALL, '') #get default canonical if necessary if canonical == 'default': canonical = locale.getdefaultlocale()[0]#canonical From the locale module help: getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')) Tries to determine the default locale settings and returns them as tuple (language code, encoding). According to POSIX, a program which has not called setlocale(LC_ALL, "") runs using the portable 'C' locale. Calling setlocale(LC_ALL, "") lets it use the default locale as defined by the LANG variable. Since we don't want to interfere with the current locale setting we thus emulate the behavior in the way described above. 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'. Except for the code 'C', the language code corresponds to RFC 1766. code and encoding can be None in case the values cannot be determined. So it's looking if LC_ALL is set, if not, it looks for LC_CTYPE, then LANG, and finally LANGUAGE. And as you have LC_CTYPE defined, it will choose that before the LANG variable. By looking at those env vars definitions at [1], I think Phatch should discard LC_CTYPE and use LC_ALL and LANG instead (in that order). Attached is a patch against trunk that fixes this. Cheers, Emilio [1] http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html#tag_08_02
=== modified file 'phatch/core/config.py' --- phatch/core/config.py 2008-04-05 21:40:10 +0000 +++ phatch/core/config.py 2008-12-05 10:15:40 +0000 @@ -68,7 +68,7 @@ locale.setlocale(locale.LC_ALL, '') #get default canonical if necessary if canonical == 'default': - canonical = locale.getdefaultlocale()[0]#canonical + canonical = locale.getdefaultlocale(envvars=('LC_ALL', 'LANG'))[0] #canonical if canonical is None: #for mac canonical = 'en'
signature.asc
Description: OpenPGP digital signature