个人工具

UbuntuHelp:Locale

来自Ubuntu中文

跳转至: 导航, 搜索

This wiki page is a work in progress. There is precious little documentation covering locales, either in books or on the web. It will take either a) a bit of time, or b) a professional, to make this page a good reference. Three question marks are a placeholder for information that is lacking.

Introduction

Locales are about your language and country i.e. fr_CA French Canadian. When you installed Ubuntu, you answered some simple questions such as specifying your country and language. Ubuntu used the answers to those questions, in part, to choose a suitable locale for your installation. The following will show which locales are available on your system

$ locale -a

To see which locale you are actually using, use

$ locale

In the output of the above query, you will see entries for: LC_CTYPE:: The character type, aka. character set, character encoding. Encoding of characters is a whole 'nother can of worms, over which whole books have been written. A simple and common character set you may be familiar with is ASCII, the American Standard Code for Information Interchange. Being an American Standard, it doesn't suit the needs of many other countries, and so you choose your own character encoding with the LC_CTYPE variable. LC_NUMERIC:: How you format your numbers. For example, in some countries, a decimal point is actually represented by a comma. LC_TIME:: How your time and date are formatted. Use for example "en_DK.UTF-8" to get a 24-hour-clock in some programs. LC_COLLATE:: How strings (file names...) are alphabetically sorted. Using the "C" or "POSIX" locale here results in a strcmp()-like sort order, which may be preferable to language-specific locales. LC_MONETARY:: What currency you use, its name, and its symbol. LC_MESSAGES:: Common system messages that should be translated into your language ??? LC_PAPER:: Paper sizes: 11 x 17 inches, A4, etc... LC_NAME:: ??? LC_ADDRESS:: Not your street address; this is ??? LC_TELEPHONE:: What your telephone numbers look like. LC_MEASUREMENT:: feet, metres, pounds, kilos... LC_IDENTIFICATION:: ??? LC_ALL:: ??? It is possible to manually change one of the locale entries to use by your system by modifying the file /etc/environment, for example append the line

LC_TIME=”en_GB.UTF-8"

to set the system locale for time format to match the Great Brittain region's. To learn more about locales and how to configure your system for a particular locale, read up on the following programs:

locales

# aptitude install locales
# dpkg-reconfigure locales

localeconf

# aptitude install localeconf
# dpkg-reconfigure localeconf

update-locale

locale-gen

To add a locale:

# locale-gen fr_FR.UTF-8

This will generate output like:

Generating locales...
  fr_FR.UTF-8... done
Generation complete.

files

/etc/environment

additional help

Documentation about the common character sets:

man ascii
man iso_8859_1
man utf8