[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: base-config cruft cleanup

peter karlsson wrote:
> It is indeed valid to specify a language code without a qualifier, for
> my LANG setting, I always use "sv", whereas I have "sv_SE.ISO8859-1"
> set for my LC_ALL. When it comes to the language settings (LANG,
> LC_MESSAGES), most languaegs don't need a qualifier at all, since
> there's only one variant. The only place they might need a qualifier is
> if they are used in different countries.

joey@silk:~>LANG=sv_SE perl -e ''
joey@silk:~>LANG=sv perl -e ''
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = (unset),
        LC_ALL = (unset),
        LANG = "sv"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

Don't you get tired of seeing those messages everywhere?

I won't argue whether the ll form is correct or not, but perl does this,
and it has a large section in the perllocale man page under "LOCALE PROBLEMS".
It's not looking at the form of the LANG setting, it is just trying to use
it, and printing out this message if it fails. Perl basically fails in the
same cases where a call to 'locale -a | grep "^$LANG$"' fails:

joey@silk:~>locale -a |grep sv

No plain "sv", and I cannot find a way to make it appear on the locale -a

This is not just perl; LANG=sv causes setlocale() to fail in general, too:

joey@silk:~>cat test.c
#include <locale.h>
int main (int argc, char **argv) {
        printf("setlocale returned: %s\n", setlocale(LC_ALL, argv[1]));
joey@silk:~>./test sv_SE
setlocale returned: sv_SE
joey@silk:~>./test sv   
setlocale returned: (null)

I'm sure that many programs do not test the return code of setlocale, but
NULL is documented in the man page to mean the setting failed..

see shy jo

Reply to: