]> git.sur5r.net Git - i3/i3/commit - man/i3.man
manpage: improve locale setup in example .xsession (Thanks Harald König)
authorMichael Stapelberg <michael@stapelberg.de>
Mon, 27 Aug 2012 13:07:18 +0000 (15:07 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Mon, 27 Aug 2012 13:07:18 +0000 (15:07 +0200)
commit67999269fd562c0be3de0ce360a10dd6c38b8bc6
tree8602cda533533cdad594dff37d5665ba69792547
parentc8cfc77b0a7c6166641b1c5849e4183ef97d600d
manpage: improve locale setup in example .xsession (Thanks Harald König)

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 <stdio.h>
    #include <locale.h>

    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