Introduction to locale in linux

Source: Internet
Author: User
Tags locale setting


Locale in linux refers to the language environment for running software defined based on the language used by computer users, the country or region where the computer is located, and the local cultural traditions. Locale divides all aspects of the involved cultural traditions into 12 categories: 1. Language Symbols and their classifications (LC_CTYPE) 2. Numbers (LC_NUMERIC) www.2cto.com 3. Comparison and habits (LC_COLLATE) 4. Time Display format (LC_TIME) 5. Currency Unit (LC_MONETARY) 6. Information mainly includes prompt information, error information, status information, title, labels, buttons and menus (LC_MESSAGES) 7. Name Writing Method (LC_NAME) 8. Address Writing Method (LC_ADDRESS) 9. Phone number Writing Method (LC_TELEPHONE) 10. LC_MEASUREMENT 11. Default paper size (LC_PAPER) 12. LC_IDENTIFICATION ). Therefore, locale is the linguistic and cultural traditions and living habits of people in a region. Locale in a region is defined according to the habits of these categories. These locale definition files are placed under the/usr/share/i18n/locales directory, such as en_US, zh_CN and de_DE @ euro are all locale definition files. These files are all written in text format. You can open them on the WordPad and check the content. Of course, there are limited comments, you may not understand most of the content, because it is a Unicode Character index. The complete locale expression for www.2cto.com is [language [_ region] [. Character Set] [@ correction value]. How to Set locale? Setting locale is to set the locale Classification attributes of 12 categories, that is, 12 LC _*. In addition to setting these 12 variables, there are two variables for convenience: LC_ALL and LANG. There is a relationship between them with a priority: LC_ALL> LC _ *> LANG. It can be said that LC_ALL is set at the upper level or mandatory, while LANG is the default value. 1. If you set LC_ALL = zh_CN.UTF-8, then no matter what the LC _ * and LANG are set to, they will be forced to obey the LC_ALL settings, become a zh_CN.UTF-8. 2. If you set LANG = zh_CN.UTF-8, and other LC _ * = en_US.UTF-8, and no LC_ALL is set, then the locale of the system is set to LC _ * = en_US.UTF-8. Www.2cto.com 3, if you set LANG = zh_CN.UTF-8, and other LC _ *, and LC_ALL are not set, the system will set LC _ * to the default value, that is, the LANG value zh_CN.UTF-8. 4. If you set LANG = zh_CN.UTF-8, and other LC_CTYPE = en_US.UTF-8, other LC _ *, and LC_ALL are not set, then the locale setting of the system will be: LC_CTYPE = en_US.UTF-8, the other LC_COLLATE, LC_MESSAGES and so on will use the default value, that is, the LANG value, that is, LC_COLLATE = LC_MESSAGES = ...... = LC_PAPER = LANG = zh_CN.UTF-8. Therefore, locale is set as follows: 1. If you need a Chinese-only system, you can set LC_ALL = zh_CN.XXXX or LANG = zh_CN.XXXX. Of course, you can set both, but as mentioned above, the value of LC_ALL will overwrite all other locale settings, so do not useless work. 2. If you only want to enter a Chinese environment and keep the menu, title, and system information as the English interface, you only need to set LC_CTYPE = zh_CN.XXXX, LANG = en_US.XXXX. In this way, LC_CTYPE = zh_CN.XXXX, while LC_COLLATE = LC_MESSAGES = ...... = LC_PAPER = LANG = en_US.XXXX. Www.2cto.com 3. If you are happy, you can set 12 LC _ * to the values you need one by one to create an antique system: LC_CTYPE = zh_CN.GBK/GBK (using the Chinese-coded internal code GBK character set); LC_NUMERIC = en_GB.ISO-8859-1 (using the British Digital System) LC_MEASUREMEN = de_DE@euro.ISO-8859-15 (German weights use the ISO-8859-15 Character Set) the address Writing Method of Rome, the paper setting in the United States ....... No one is doing this. 4. If you do nothing, that is, LC_ALL, LANG and LC _ * do not specify a specific value, the system uses POSIX as lcoale, that is, C locale.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.