Like the LANG variable, the LC_ALL environment variable provides a general announcement mechanism for the entire locale, and it uses the same syntax. Unlike LANG, LC_ALL has the top precedence, which means that it overrides all other international environment variables. Setting LC_ALL is sufficient if one preset locale satisfies all user requirements for program localization.
LANG has the lowest precedence; so if it is set, it is still possible to set other international environment variables to customize the working environment of individual users to meet their specific requirements.
Precedence | Environment variable |
high | LC_ALL |
medium | LC_CTYPE |
low | LANG |
A typical case not covered by either LANG or LC_ALL is where you want to communicate with the system in one language but sort text files, for example, in another. In cases of this type, you set the international environment variables which allow you to modify individual aspects (categories) of your locale.
Thus if you want to communicate with the system in British English but you also need to sort German text files, you should define the following settings for the LANG and LC_COLLATE environment variables:
LANG=En
LC_COLLATE=C
By setting other variables you can set up a multi-language working environment.
Note that the LC_ALL environment variable must be left unset in such cases, as it overrides all other international environment variables. If LC_COLLATE and LC_ALL are both set, LC_COLLATE is ignored.