Bug in module time: localization?
hartmut Goebel
hartmut at oberon.noris.de
Sun Mar 26 13:28:56 EST 2000
Hello,
python 1.5.2 seams to ignore locale setting when generating names of month of
weekday. Below find a test skript which always print english names ("Monday
March") instead of german ones ("Montag März").
The shell command 'date "+%A %B"' returns the expected result: localized.
Does anyone have an idea how to solve this problem?
[hartmut at lenashee hsc]$ python /tmp/testlang.py
ENV : /home/hartmut/.bashrc
LC_ALL : de_DE
LC_TYPE : ISO-8859-1
LANG : de
LINGUAS : de
LC_MESSAGE: C
Monday March
LANG : de_DE Monday March
LINUAS : de_DE Monday March
LC_ALL : de_DE Monday March
LC_DATE : de_DE Monday March
LC_MESSAGE: de_DE Monday March
[hartmut at lenashee hsc]$ python
Python 1.5.2 (#1, Nov 7 1999, 00:47:55) [GCC 2.95.2 19991024 (release)] on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>>
...8<--------------
#!/usr/bin/python
import os, time
interestingEnv = ('ENV', 'LC_ALL', 'LC_TYPE', 'LANG', 'LINGUAS', 'LC_MESSAGE')
oldEnv = {}
testTime = (2000, 03, 11, 0, 0, 0, 0, 0, 0)
def printEnv(env = interestingEnv):
for i in env:
print "%-10s:\t%s" % (i, os.environ[i])
def testDate(env, value):
os.environ[env] = value
print "%-10s:\t%s\t\t" % (env, os.environ[env]),
print time.strftime("%A %B", testTime)
printEnv()
print time.strftime("%A %B", testTime)
testDate('LANG', 'de_DE')
testDate('LINUAS', 'de_DE')
testDate('LC_ALL', 'de_DE')
testDate('LC_DATE', 'de_DE')
testDate('LC_MESSAGE', 'de_DE')
...8<--------------
+++hartmut
More information about the Python-list
mailing list