Gentoo Archives: gentoo-user

From: Steffen Loos <fenlo@×××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] More locale oddness
Date: Fri, 07 Jan 2011 09:08:33
Message-Id: 4D26CD22.8010908@gmx.net
In Reply to: [gentoo-user] More locale oddness by Stroller
1 Am 07.01.2011 02:49, schrieb Stroller:
2 > Hi there,
3 >
4 > Can anyone else reproduce this, please, or tell me what behaviour is expected?
5 >
6 > $ locale
7 > LANG=en_GB.UTF-8
8 > LC_CTYPE="en_GB.UTF-8"
9 > LC_NUMERIC="en_GB.UTF-8"
10 > LC_TIME=en_GB.UTF-8
11 > LC_COLLATE="en_GB.UTF-8"
12 > LC_MONETARY="en_GB.UTF-8"
13 > LC_MESSAGES="en_GB.UTF-8"
14 > LC_PAPER="en_GB.UTF-8"
15 > LC_NAME="en_GB.UTF-8"
16 > LC_ADDRESS="en_GB.UTF-8"
17 > LC_TELEPHONE="en_GB.UTF-8"
18 > LC_MEASUREMENT="en_GB.UTF-8"
19 > LC_IDENTIFICATION="en_GB.UTF-8"
20 > LC_ALL=
21 > $ date +"%l:%M%P"
22 > 1:39
23 > $ LC_TIME="POSIX"
24 > $ date +"%l:%M%P"
25 > 1:39am
26 > $
27 On my host it looks the same.
28 It's based on the definitions in /usr/share/i18n/locales/*.
29
30 If you are asking why just have a look on the files there and search for am_pm.
31 Eg. for en_GB this is the decisive line:
32 user@host /usr/share/i18n/locales $ grep am_pm en_GB
33 am_pm "";""
34 which means: write nothing. And for POSIX:
35 user@host /usr/share/i18n/locales $ grep am_pm POSIX
36 am_pm "<U0041><U004D>";"<U0050><U004D>"
37 which represents "AM;PM" in Unicode.
38
39
40 >
41 > I had a single line of only LANG="en_GB.UTF-8" in /etc/env.d/02locale; adding LC_TIME="POSIX" allows various scripts and stuff (I've written) to show the date properly, but I think I read somewhere that this is bad.
42 >
43 Hm, it's up to you which locales matches your needs. Maybe a more portable(in sense of locales) timestamp format in your scripts could also be a way.
44
45
46 Steffen