Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It seems both the LANG and LANGUAGE environment variable are used by some programs to determine their user interface language.

What are the exact semantics of these variables and where can I read about their correct usage? The manpage for locale(1) only mentions the LC_* family of environment variables. Additionally there is also an LC_ALL variable commonly in place which isn't described there either.

share|improve this question
up vote 8 down vote accepted

LANG contain the setting for every categories that are not directly set by a LC_* variable.

LC_ALL is used to override every LC_* and LANG and LANGUAGE, it should not be set in a normal user environment, but can be useful when you are writing a script that depend on the precise output of a internationalized command.

LANGUAGE is used to set messages languages (as LC_MESSAGES) to a multivaluated value: setting it to "fr:de:en" will use French message where they exists, if not it will use German messages, and will fallback to English one if there isn't German nor French messages.

share|improve this answer
Where can I find documentation about LANGUAGE? Is it mutually exclusive to LC_MESSAGES? – aef Feb 22 '12 at 0:44
Everything is in the locale(7) manpage. LC_MESSAGES changes the language messages are displayed in and what an affirmative or negative answer looks like. The GNU C-library contains the gettext(3), ngettext(3), and rpmatch(3) functions to ease the use of these information. The GNU gettext family of functions also obey the environment variable LANGUAGE (containing a colon-separated list of locales) if the category is set to a valid locale other than "C". – Rémi Feb 24 '12 at 15:08
@Rémi can you elaborate on why LC_ALL should not be used? – Édouard Lopez Feb 2 at 12:21
Not much to say. You have more flexibility if you set LANG than if you set LC_ALL: you can set LANG to something and LC_COLLATE to some other thing. If you set LC_ALL, every other configuration are hidden. – Rémi Feb 3 at 22:35

Have a look at the manpage locale(7): it describes that LANG is a fallback setting, while LC_ALL overrides all separate LC_* settings.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .