UbuntuHelp:LocaleConf
来自Ubuntu中文
点击翻译: |
English |
请不要直接编辑翻译本页,本页将定期与来源同步。 |
<<Include(Tag/ContentCleanup)>> If you need to change the language and keyboard configuration, follow these instructions:
目录
Language configuration
Cleaning up unused locales
Install localepurge to remove any unwanted languages, while choosing the ones you want to keep. Note that this method will not change the locales settings on your system. It will just purge the locales you have not selected. Use at your own risk.
$ sudo apt-get install localepurge
After that, you should reboot your computer. To reconfigure this, simply enter the following in terminal.
$ sudo dpkg-reconfigure localepurge
Type the following command to print-out your current locale configuration.
$ locale
Legacy Versions of Ubuntu
First install the following packages: locales localeconf
(see InstallingSoftware).
(Package localeconf does not exist in neither gutsy nor intrepid)
When configuring the packages, you'll be asked a series of questions, but the most important are:
Select supported locales:
Select your language and its encoding. The encoding is how characters
will be treated by the operating system. A good rule is to choose utf-8
locales.
For example, for my machine I chose: en_US.utf-8 and pt_PT.utf-8
Manage configuration with debconf:
Unless you're familiar with editing configuration files by hand, choose yes.
Default system locale:
If you prefer to have an English user interface, choose (like I
did) en_US.utf-8, otherwise choose the language you selected during the
supported locales configuration.
Settings to override:
This is where things get a little tricky. For example, I want my
text to be "treated" with the Portuguese layout and also to use our
national numeric and date formats, but the rest to be plain english, so
I chose to override the LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC
and LC_DATE settings.
The following steps involve choosing the locale to apply to the
settings you chose to override. In my system, I chose pt_PT.utf-8.
After the install system has finished setting up your locales, you're
done. The next time you reboot your system, your new preferences will
be applied. If you ever need to change this, execute the command:
$ sudo dpkg-reconfigure localeconf
Note: since ubuntu 6.06, some users experienced problems with that configuration and they were unable to change their installed languages/encodings. For a workaround see the section "For Anti-UTF-8 people" below.
For Anti-UTF-8 people
This is an expert's section, so if you don't know what UTF-8 is and why you should care, please
skip this section. This is oriented to those users that have problems configuring their locales/encodings
on ubuntu 6.06.
To make ubuntu forget UTF-8, you will need to follow these steps (please, first try the instructions
in the section above):
Generate ONLY the locales you want:
See the first column of the file /usr/share/i18n/SUPPORTED and identify your language codes,
example: en_US es_VE pt_BR es_ES
. Note that the second column shows the encoding to be used
with that language code and remember that we don't want UTF-8 as encoding.
After you know which language codes you will use, go to the terminal and type the following:
$ sudo locale-gen LANG1 LANG2 LANG3 ...
Where LANG1, LANG2, ...
are the language code you selected. As an example, a user in Venezuela
may want:
$ sudo locale-gen es_VE en_US
After that, you should reboot your computer.
Make GDM forget about UTF-8
In the file /etc/X11/gdm/locale.conf
GDM stores its definitions for the language that you can choose
at login time. The first column has the display name and the second the language code to use with it.
Just find the language you want to use and delete the line that defines the UTF-8 variant if it exists.
Now you should restart your X server with control+alt+bkspace and login again to make GDM read the locales again.
When you login again you should not find "UTF-8" in the output of the command (type in terminal)
$ env | grep LANG
If you see the word "UTF-8" as output here, maybe you skipped some steps. Enjoy your computer UTF-8 free!
Keyboard configuration - console
To configure your console keyboard layout, install the following package: console-data
(See InstallingSoftware).
If the package console-data is already installed, use the following command instead
$ sudo dpkg-reconfigure console-data
When the configuration dialog is displayed, choose to select a keymap from the "arch list". The most tipical keyboard layout is "qwerty" (look at the first row of letters in your keyboard) so choose this unless you have something different. Next, select a keyboard layout. My keyboard has a Portuguese layout so I chose that. In case you're also choosing a Portuguese layout, when asked about a specific keymap, select the "Standard" option. I haven't looked into other options so this may vary a little bit for your configuration. Press OK and you're done. Reboot your computer to use your new keyboard layout.
Keyboard configuration - Desktop
The easiest way to switch to a new layout in your Desktop Environment is to click Computer/Desktop Preferences/Keyboard Preferences. On the Layouts pane, remove the currently selected layout and choose your prefered layout from the list on the right side on the pane. Press the Close button and logout. When you login again, you should be using your selected keyboard layout. Note: if you have a Microsoft keyboard (one with a Windows key in between the left Ctrl and Alt keys), and you want to use that extra key, on the Layouts pane select the "Generic 105-key PC" layout and in the Layout Options pane select the "Super is mapped to the Win-keys" option from the Available Options-Alt/Win key behaviour list. From PeterParkkali Mon Feb 28 00:48:47 +0000 2005 From: Peter Parkkali Date: Mon, 28 Feb 2005 00:48:47 +0000 Subject: Language reconfiguration Message-ID: <20050228004847+0000@https://www.ubuntulinux.org> The "Default system locale" setting seems to be managed by 'locales' package, so the I think a more thorough reconfiguration command would be $ sudo dpkg-reconfigure locales localeconf Or even {[[ $ sudo dpkg-reconfigure -plow locales localeconf }}} to make sure it asks everything. From PeterParkkali Mon Feb 28 02:13:29 +0000 2005 From: Peter Parkkali Date: Mon, 28 Feb 2005 02:13:29 +0000 Subject: Per-user language selection? Message-ID: <20050228021329+0000@https://www.ubuntulinux.org> Hmm, is it possible for users to choose their own $LANG and $LC_* values? Setting them in ~/.profile and ~/.bash* probably won't help, as they affect only CLIs.