18

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.

20

LANG contain the setting for all 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 an internationalized command.

LANGUAGE is used to set messages languages (as LC_MESSAGES) to a multi-valued value, e.g., setting it to fr:de:en will use French messages where they exist; if not, it will use German messages, and will fall back to English if neither German nor French messages are available.

  • Where can I find documentation about LANGUAGE? Is it mutually exclusive to LC_MESSAGES? – aef Feb 22 '12 at 0:44
  • 1
    @Rémi can you elaborate on why LC_ALL should not be used? – Édouard Lopez Feb 2 '16 at 12:21
  • 1
    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 '16 at 22:35
  • 1
    I don't think LC_ALL overrides LANGUAGE: 1. they have different meanings (order [e.g.: fr:de:en] vs. characteristics[e.g.: fr_FR]) – Murmel Jun 6 '18 at 15:11
  • 3
    2. The GNU getText documentation's chapter Specifying a Priority List of Languages states: gettext gives preference to LANGUAGE over LC_ALL and LANG. Additionally, the chapter Locale Environment Variables states: 1. LANGUAGE 2. LC_ALL [...] – Murmel Jun 13 '18 at 12:25
9

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

  • 2
    man 7 locale is the command – Smile4ever Jan 8 '17 at 15:52
2

For reference, the locale system is GNU GetText, which has its full documentation available in the gettext-doc package (Debian/Ubuntu).

Alternatively, there is an online manual with authoritative and elaborate documentation of the LANG and LANGUAGE environment variables.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.