Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 81895 - more variables / Setting system-wide language environment
Summary: more variables / Setting system-wide language environment
Status: RESOLVED FIXED
Alias: None
Product: [OLD] Docs-user
Classification: Unclassified
Component: Localisation Guide (show other bugs)
Hardware: All Linux
: High enhancement (vote)
Assignee: Sven Vermeulen (RETIRED)
URL:
Whiteboard:
Keywords:
: 81152 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-02-13 11:53 UTC by Stanislav Brabec
Modified: 2005-06-02 12:09 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stanislav Brabec 2005-02-13 11:53:47 UTC
In variable list there are missing following variables/notes:

LC_ALL - It is not recommended to set this variable in system-wide environment. It breaks scripts like "LC_COLLATE=C sort".

LANGUAGE - This variable is similar to LC_MESSAGES, but it allows to search in message catalogs of more languages and cannot be overriden by LC_ALL. For more see "(libc.info.gz)Using gettextized software".

LINGUAS - see "(gettext.info.gz)Installers". I am not sure whether it is not overwritten by uselocale USE flag.


Setting system-wide language environment.

I don't know any clean solution. There are two solutions I found:

Setting variable LANG by adding another file to /etc/env.d. But this has a drawback - display managers like gdm cannot set language.

There is a solution I use: Adding following line to /etc/profile:
[ -z "$LANG" ] && LANG="my_locale"


Reproducible: Always
Steps to Reproduce:
Comment 1 Flammie Pirinen (RETIRED) gentoo-dev 2005-02-13 13:16:33 UTC
> LC_ALL - It is not recommended to set this variable in system-wide environment. It breaks scripts like "LC_COLLATE=C sort".

If a script relies on LC_anything=C it's broken, but I do agree that it's probably best to leave system environment's locale settings to POSIX. Isn't this already told in the guide?

> LANGUAGE - This variable is similar to LC_MESSAGES, but it allows to search in message catalogs of more languages and cannot be overriden by LC_ALL. For more see "(libc.info.gz)Using gettextized software".

Yes, and actually, LANGUAGE does also affect man page selection while LC_MESSAGES doesn't, IIRC. 

> LINGUAS - see "(gettext.info.gz)Installers". I am not sure whether it is not overwritten by uselocale USE flag.

userlocales? I don't think so, and IIRC the LINGUAS is even mentioned in some software's installation in same guide.


> Setting variable LANG by adding another file to /etc/env.d. But this has a drawback - display managers like gdm cannot set language.

Doesn't GDM set LC_ALL which overrides this? 

> There is a solution I use: Adding following line to /etc/profile:
[ -z "$LANG" ] && LANG="my_locale"

This seems like a good solution at first glance.

I actually started another bug regarding environment variables in Gentoo docs in general after getting updates to guide-localization done. It seems that every other documentation gives a bit different instructions on setting local and global environments. As I don't think it's a good idea to track multiple problems in one bug I suggest further discussion on environment variable handling in bug 81152.
Comment 2 Stanislav Brabec 2005-02-14 02:08:58 UTC
> > LC_ALL
> Isn't this already told in the guide?
Yes, it is, but recommendation to leave it unset would be nice. "LC_COLLATE=C sort" is not the only reason to not set in.

Most programs will work with LC_ALL only, but some of them behaves incorrectly, if LC_ALL is set, but LANG not (e. g. gtk1). It can cause ugly bug reports. I have even found people setting LANG to UTF-8 locale and LC_ALL to ISO locale.

> Doesn't GDM set LC_ALL which overrides this?

No. It sets LANG variable and then starts login process. This is another reason, why to not use LC_ALL for system-wide locale.
Comment 3 Xavier Neys (RETIRED) gentoo-dev 2005-05-17 07:20:46 UTC
*** Bug 81152 has been marked as a duplicate of this bug. ***
Comment 4 Sven Vermeulen (RETIRED) gentoo-dev 2005-06-02 12:09:03 UTC
I've added a note on defining both LC_ALL and LANG and /why/ (i.e. misbehaving
applications). However, I don't want to do more than this note as such programs
need to be fixed, not the documentation.