Locale,lang in Linux

Source: Internet
Author: User
Tags i18n locale posix

Locale is a language environment defined by a software runtime based on the language of the computer user, the country or region in which it is used, and the local cultural tradition.

Can be found locale in the command, can display multiple LC_* and LANG .

1 LANG

LANGvariable is the abbreviation of language, in a system variable, it determines the system's default language, namely the system's menu, the program's toolbar language, the Input method default language and so on.

LANGAfter logging into the system it is read and takes effect, Unbuntu, is read from the following file.

Look at the format: zh_CN.UTF-8 , where zh_CN this combination can be seen in many places, and the complete expression is:

In Ubuntu, these combinations are in the /usr/share/i18n/locales file:

The i18n source is the English word internationalization the first characters I and n,18 are the middle character number, is the abbreviation of "internationalization". means that products (publications, software, hardware, etc.) can adapt to different languages and regions without the need for big changes. For the program, The corresponding interface can be displayed according to different languages and regions without modifying the internal code. In the age of globalization, internationalization is especially important because potential users of products may come from all corners of the world. There are also l10n ("localized" abbreviations) that are often associated with i18n.

The contents of these files are mainly defined for the format of 12 small items:

LC_CTYPE                    #用户所使用的语言符号及其分类LC_NUMERIC                #数字LC_TIME                      #时间显示格式LC_COLLATE                #比较和排序习惯LC_MONETARY             #LC_MONETARYLC_MESSAGES             #信息主要是提示信息,错误信息, 状态信息, 标题, 标签, 按钮和菜单等LC_PAPER                    #默认纸张尺寸大小LC_NAME                     #姓名书写方式LC_ADDRESS               #地址书写方式LC_TELEPHONE             #电话号码书写方式LC_MEASUREMENT        #度量衡表达方式LC_IDENTIFICATION      #对自身包含信息的概述

For example: en_HK part of a file LC_IDENTIFICATION :

and zh_CN the LC_TIME parts are:

The corresponding Chinese is, Monday ... And so on. This is the command in Chinese Linux, such as the date output of specific information format, for example:

will be LANG set to a different value, the output may be in a different form.

Different small items of different files may be different. Thus, the localization process has been completed.

2 locale

LANGVariable, can only change the above 12 items globally, that is to say:

LC_CTYPE                    #用户所使用的语言符号及其分类LC_NUMERIC                #数字LC_TIME                      #时间显示格式LC_COLLATE                #比较和排序习惯LC_MONETARY             #LC_MONETARYLC_MESSAGES             #信息主要是提示信息,错误信息, 状态信息, 标题, 标签, 按钮和菜单等LC_PAPER                    #默认纸张尺寸大小LC_NAME                     #姓名书写方式LC_ADDRESS               #地址书写方式LC_TELEPHONE             #电话号码书写方式LC_MEASUREMENT        #度量衡表达方式LC_IDENTIFICATION      #对自身包含信息的概述

The value of these 12 entries is equal to LANG the value by default.

In the Linux environment variable, these 12 values can be set individually:

LC_*="*"export LC_*

You can set an item individually.

There LC_ALL can be a unified set of the above 12 small items, the priority of the three is:

LC_ALL> LC_* >LANG

3 Lc_all=c

The LC_ALL=C meaning is: "C" is the system default locale, "POSIX" is the "C" alias. So when we install a new system, the default locale is C or POSIX.

4 Change the file name to English

When installing the Linux system, if the language is selected in Chinese, then after the installation, the user directory of the desktop, download and other folders are Chinese, not conducive to the operation of the terminal, so the folder will be changed to English:

export LANG=en_US  xdg-user-dirs-gtk-update  export LANG=zh_CN  
5 Other

Many articles say that the locale value of and LANG is also related to Chinese input problems. No examples of this have been found.

Therefore, the most current is the interface and the terminal in the different language environment of the explicit format differences.

Locale,lang in Linux

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.