Fundamentals 9 min read

Master Linux Locale: Decode LC_* Categories and Configure Your System

This article explains what a locale is, details the twelve LC_* categories, shows how locale definition files are structured, and provides practical guidance on setting LC_ALL, LANG, and other variables to customize language, regional, and encoding settings on Linux systems.

MaGe Linux Operations
MaGe Linux Operations
MaGe Linux Operations
Master Linux Locale: Decode LC_* Categories and Configure Your System

In computing, a locale defines the language, territory, and cultural conventions that a program uses at runtime, based on the user's language, country/region, and local traditions.

The locale system divides cultural conventions into twelve major categories, each represented by an LC_ variable:

Language symbols and classification (LC_CTYPE)

Numeric formatting (LC_NUMERIC)

Collation and sorting rules (LC_COLLATE)

Time display format (LC_TIME)

Monetary units (LC_MONETARY)

Message texts such as prompts, errors, and titles (LC_MESSAGES)

Name formatting (LC_NAME)

Address formatting (LC_ADDRESS)

Telephone number formatting (LC_TELEPHONE)

Measurement units (LC_MEASUREMENT)

Paper size defaults (LC_PAPER)

Overview of the locale’s own information (LC_IDENTIFICATION)

Locale definition files (e.g., en_US, zh_CN, de_DE@euro) reside in /usr/share/i18n/locales and are plain‑text files that can be opened with any editor, though much of the content uses Unicode character indexes.

The suffix after “@” in a locale name denotes a modifier; for example, de_DE@euro uses European sorting and comparison conventions, whereas de_DE follows standard German conventions.

A locale string follows the pattern language[_territory][.codeset][@modifier]. Examples include:

zh_CN.GB2312 – Chinese (China) with GB2312 character set.

zh_CN.GB18030 – Chinese (China) with GB18030 character set.

zh_TW.BIG5 – Chinese (Taiwan) with Big5 character set.

en_GB.ISO-8859-1 – English (Great Britain) with ISO‑8859‑1 character set.

de_DE.UTF-8@euro – German (Germany) with UTF‑8 encoding and European modifier.

The most critical category for Chinese input is LC_CTYPE, which defines valid characters, their classifications (uppercase, lowercase, punctuation, etc.), and includes the Unicode class “hanzi” that makes Chinese characters legal in Linux regardless of the underlying codeset.

To set a locale, you assign values to the twelve LC_ variables, or more conveniently to LC_ALL and LANG. Their precedence is LC_ALL > specific LC_* > LANG. For instance, setting LC_ALL=zh_CN.UTF-8 forces all locale categories to use that value, overriding any other settings.

If LC_ALL=zh_CN.UTF-8 , all other LC_* and LANG are ignored.

If LANG=zh_CN.UTF-8 and other LC_* are set to en_US.UTF-8 without LC_ALL , the system uses the specific LC_* values.

If only LANG=zh_CN.UTF-8 is set, all unset LC_* variables default to that value.

If LANG=zh_CN.UTF-8 but LC_CTYPE=en_US.UTF-8 and no LC_ALL , then LC_CTYPE uses the English setting while the remaining categories fall back to LANG .

In summary, to obtain a fully Chinese system, set LC_ALL=zh_CN.* or LANG=zh_CN.*; to keep the interface in English while enabling Chinese input, set LC_CTYPE=zh_CN.* and LANG=en_US.*. If no locale variables are defined, the system defaults to the POSIX “C” locale.

The difference between LANG and LANGUAGE is that LANGUAGE is used by most programs to select the interface language, whereas LANG provides a low‑priority default for all locale‑related variables.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Linuxinternationalizationsystem configurationlocaleLC_*
MaGe Linux Operations
Written by

MaGe Linux Operations

Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.