1

When I type on my Linux command prompt

locale

I get a long list of LC_* variables (like LC_TIME and so on). The value of the variables looks something like the ones from this list:

en_US.8859-1
de_DE@euro
fr_FR.utf-8

What exactly do the individual parts mean?

I know that @euro is identical to .8859-15 and generally the last part means the actual charset (the mapping of bytes to actual symbols). But what exactly do the first two codes "do"? What properties of the system do they influence? For example (just to have some example to work with), what is the difference between en_US.8859-15, de_DE.8859-15, de_CH.8859-15 and en_CU.8859-15? All have the exact same charset, so all textfiles that I open in the editor of my choice would looke the same. So what would happen if I switch from one "pre-charset code" to another "pre-charset code" (like from de_CH to en_US)?

Are there any tables that list the differences in a nice, easy-to-read table?

2

The two parts form an ISO-639 language code. The first part is the language itself, and the second is (usually) a country code specifying which local variant.

You can observe the effect of changing LANG with almost any program that has translations. LC_COLLATE affects the results of the sort program; LC_DATE affects the output of date and ls -l. For some locale settings, it's possible (even likely) that you have nothing installed that uses them.

On most systems, only LC_LANG is set, and all the other settings fall back to inheriting from that.

The following quote from the man page of locale(7) is relevant:

LC_COLLATE
This is used to change the behavior of the functions strcoll(3) and strxfrm(3), which are used to compare strings in the local alphabet. For example, the German sharp s is sorted as "ss".
LC_CTYPE
This changes the behavior of the character handling and classification functions, such as isupper(3) and toupper(3), and the multibyte character functions such as mblen(3) or wctomb(3).
LC_MONETARY
changes the information returned by localeconv(3) which describes the way numbers are usually printed, with details such as decimal point versus decimal comma. This information is internally used by the function strfmon(3).
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".
LC_NUMERIC
changes the information used by the printf(3) and scanf(3) family of functions, when they are advised to use the locale-settings. This information can also be read with the localeconv(3) function.
LC_TIME
changes the behavior of the strftime(3) function to display the current time in a locally acceptable form; for example, most of Europe uses a 24-hour clock versus the 12-hour clock used in the United States.
LC_ALL All of the above.

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.