set locale this can be done from python
import locale
locale.setlocale(locale.LC_ALL, 'de_DE')
I just quickly browsed through the Python doc for this module, and it
seems to me that this just to be used by an application to change which
locale it should used
- C if not set
- system default if called with locale.setlocale(locale.LC_ALL,'')
- custom if called with locale.setlocale(locale.LC_ALL,'blabla')
So unless I miss the point, or read too fast, this is not setting the
system default locale, which is what we want here :)
Meaning we probably have to set and store $LANG for the users that will
run this tool.
yes i realised earlier today about this. So we will need to mix shell
commands with python commands when we find they help. I think in the
case of getting the installed locales it does, does it?
import os
os.listdir('/usr/lib/locale')
>>> ['en_GB.utf8', 'de_DE.utf8', 'es_ES.utf8', 'eu_ES.utf8',
'ru_RU.utf8', 'locale-archive', 'fr_FR.utf8', 'en_US.utf8']
but the python output is different than the shell command output, python
only reads the .utf8 items
% locale -a
C
de_DE.iso885915
de_DE.utf8
en_GB.utf8
en_US.utf8
es_ES.iso885915
es_ES.utf8
eu_ES.iso885915
eu_ES.utf8
eu_FR.iso885915
fr_FR.iso885915
fr_FR.utf8
it_IT.iso885915
POSIX
pt_BR.iso885915
ru_RU.koi8r
ru_RU.utf8
sl_SI.iso885915
i dont know very well, as you probably noticed, all this locale stuff so
if i say something stupid just tell me ;) i will try not to...
---
[email protected]
http://identi.ca/group/puredyne
irc://irc.goto10.org/puredyne