2.3 Localization Flashcards
Why is it important to configure locale settings?
The locale settings determine the way inforation is displayed on the computer and how data is encoded. If set incorrectly, information may be presented to users in ways that are unfamiliar to them, and data integrity issues may occur within applications and databases.
What type of elements can be configured using the locale settings?
The locale settings can configure the language and encoding of the text displayed on screen, character classes, sort order, number formatting, currency type, currency format, and date/time format.
What is the syntax of the locale settings?
The locale setting uses the format: Language_territory.codset@modifier. Examples: en_GB.UTF-8 and de_DE.euro.
Which environment variable overrides all other locale settings?
The LC_ALL variable is a special variable for overriding all other settings. It sets all locales to the same setting.
What is a locale?
A locale is a set of files that Linux uses to determine country and language-specific settings for various applications.
What does the locale setting do?
The locale setting determines the way data displays on a computer:
- The language and encoding of the text displayed on screen
- Character classes
- Sort order
- Number formatting
- Currency type and format
- Date and time display
What are the key characteristics of the locale setting?
The locale setting:
- Uses configuration files that are part of the system library and are located in /usr/share/locale on most distributions.
- Uses language codes specified in ISO-639 and county codes specified in ISO-3166.
- Uses the format: language_territory.codset@modifier. Examples: en_GB.UTF-8, de_DE.euro, and en_IE.iso885915@euro.
How are locale codes implemented?
Locale codes are implemented using environment variables. For example LANG=en_US.UTF-8 specifies that the computer uses US English with a UTF-8 encoding when displaying information.
What are the four components of the locale setting?
- Language - ISO 639 language code, always lowercase
- Territory - ISO 3166 country code, always uppercase
- Codeset - Encoding format, such as UTF-8 or UTF-16
- Modifier - Seldom used
What is the order of precedence for the locale variables?
- If the LC_ALL variable is set, it overrides all LC_* variables, whether they are set or not. They are not even checked.
- if the LC_ALL variable is not set or is null, then the values of the individual LC_* variables are used.
- if the LC_ALL variable is not set and an individual LC_* variable is not set or is null, then the value of the LANG variable is used as the value of the unset LC_* variable.
How do you view all current locale settings?
The locale command displays all current locale settings.
What does the locale command do?
The locale command displays all current locale settings.
How do you view the current encoding being used on the system?
The locale charmap command displays the current encoding being used on the system.
What does the locale charmap command do?
The locale charmap command displays the current encoding being used on the system.
How do you view a list of all available locale settings on the system?
The locale -a command displays a list of all available locale settings on the system.
What does the locale -a command do?
The locale -a command displays a list of all available locale settings on the system.
How do you view a list of all available encodings on the system?
The locale -m command displays a list of all available encodings on the system.
What does the locale -m command do?
The locale -m command displays a list of all available encodings on the system.
How can you convert from one encoding to another?
The iconv command converts from one encoding to another.
What does the command iconv -f ISO8859-1 -t UTF-8 infile.txt do?
Converts the file infile.txt from ISO8859-1 encoding to UTF-8 and writes the result to standar output. (You can write the result to a new file using redirection or with the -o file_name option.)
What does the LANG locale variable do?
The LANG variable defines all locale settings at once, while allowing further individual customization via the LC_* settings.
What does setting the locale variable LANG=C accomplish?
When LANG=C, programs display output without passing it through locale translations. This is helpful when the output is being corrupted by the locale, and will help avoid some types of problems, such as when using pipelines and scripts that pass on a program’s data to another program in binary form.
Whose responsibility is localization support?
Localization support is the responsibility of the program’s author. Many programs only support one language or a small subset of languages.
What does the LC_CTYPE locale variable do?
The LC_CTYPE variable defines the character handling properties for the computer. This determines whether characters are recognized as alphabetical, numeric and so on. This also determines the character set used, if applicable.