From 67999269fd562c0be3de0ce360a10dd6c38b8bc6 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 27 Aug 2012 15:07:18 +0200 Subject: [PATCH] =?UTF-8?q?manpage:=20improve=20locale=20setup=20in=20exam?= =?UTF-8?q?ple=20.xsession=20(Thanks=20Harald=20K=C3=B6nig)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Harald mentioned he was surprised about the locales we recommend in the .xsession example, so I’ve re-investigated. Here is the test program I have used: #include #include int main() { /* SUSv2 setlocale(3) says: * Internationalised programs must call setlocale() to initiate * a specific language operation. This can be done by calling * setlocale() as follows: */ setlocale(LC_ALL, ""); printf("LC_NUMERIC is %s\n", setlocale(LC_NUMERIC, NULL)); } Then, I have unset LANG and LC_*: midna /tmp $ env | grep LANG midna /tmp $ env | grep LC midna /tmp $ Now, observe that LC_ALL overwrites all specific LC variables: midna /tmp $ LC_ALL=de_DE.UTF-8 LC_NUMERIC=en_DK.UTF-8 ./localetest LC_NUMERIC is de_DE.UTF-8 However, LANG does not: midna /tmp $ LANG=de_DE.UTF-8 ./localetest LC_NUMERIC is de_DE.UTF-8 midna /tmp $ LANG=de_DE.UTF-8 LC_NUMERIC=en_DK.UTF-8 ./localetest LC_NUMERIC is en_DK.UTF-8 This is consistent with what perldoc perllocale says: http://perldoc.perl.org/perllocale.html#ENVIRONMENT --- man/i3.man | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/man/i3.man b/man/i3.man index c20e39da..c2b9039c 100644 --- a/man/i3.man +++ b/man/i3.man @@ -262,19 +262,15 @@ xset -b # Enable zapping (C-A- kills X) setxkbmap -option terminate:ctrl_alt_bksp -# Enforce correct locales from the beginning -unset LC_COLLATE -export LC_CTYPE=de_DE.UTF-8 -export LC_TIME=de_DE.UTF-8 -export LC_NUMERIC=de_DE.UTF-8 -export LC_MONETARY=de_DE.UTF-8 +# Enforce correct locales from the beginning: +# LC_ALL is unset since it overwrites everything +# LANG=de_DE.UTF-8 is used, except for: +# LC_MESSAGES=C never translates program output +# LC_TIME=en_DK leads to yyyy-mm-dd hh:mm date/time output +unset LC_ALL +export LANG=de_DE.UTF-8 export LC_MESSAGES=C -export LC_PAPER=de_DE.UTF-8 -export LC_NAME=de_DE.UTF-8 -export LC_ADDRESS=de_DE.UTF-8 -export LC_TELEPHONE=de_DE.UTF-8 -export LC_MEASUREMENT=de_DE.UTF-8 -export LC_IDENTIFICATION=de_DE.UTF-8 +export LC_TIME=en_DK.UTF-8 # Use XToolkit in java applications export AWT_TOOLKIT=XToolkit