Funtoo Linux 本地化

From Funtoo
Revision as of 10:51, April 8, 2021 by Mmwweettyy (talk | contribs) (Created page with "还需要安装 ibus 的语言表(中文)")
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Other languages:
English • ‎Türkçe • ‎español • ‎polski • ‎português do Brasil • ‎中文(中国大陆)‎

设置默认语言

On Funtoo, there are two configuration files responsible for your language settings: /etc/locale.gen and /etc/env.d/00basic. First file has only en_US.UTF-8 locale enabled. Last one is a default shipped file comes from stage3 and responsible for en_US.UTF-8 locale system-wide. Not recommended to edit. The following steps will guide you through the process of setting up the default system language, using French Canadian as an example. First you will need to edit /etc/locale.gen:

root # nano -w /etc/locale.gen

Specify your preferred locale with the accompanying character format (you will mostly want UTF-8):

   Note

It is recommended to keep the preconfigured en_US.UTF-8 locale as a fallback.

   /etc/locale.gen
en_US.UTF-8 UTF-8
fr_CA.UTF-8 UTF-8

To determine an appropriate locale for your system, you should take a look into /usr/share/i18n/SUPPORTED for the default list of supported combinations or check the /usr/share/i18n/locales/ directory for a list of valid values.

   Warning

You are strongly advised to use at least one UTF-8 locale since some applications may require it.

现在,这些地域需要生成:

Once done, you can apply your locale settings system-wide. First display all available options:

user $ eselect locale list
root ##b##Available targets for the LANG variable:
  [1]   C
  [2]   POSIX
  [3]   fr_CA.utf8
  [4]   en_US.utf8 *
  [ ]   (free form)

The blue star indicates the current default system locale. You can now change it according your wishes:

root # eselect locale set 3
Setting LANG to fr_CA.utf8 ...
Run ". /etc/profile" to update the variable in your shell.

Alternatively, you can set the default locale manually. This file should be created first with your prefered editor:

   /etc/env.d/02locale
LANG="fr_CA.utf8"

You can verify your actions using:

user $ eselect locale show
root ##b##LANG variable in profile:
  fr_CA.utf8

为了达到立竿见影的效果,需要重新加载环境:

root # env-update && source /etc/profile
>>> Regenerating /etc/ld.so.cache...

恭喜!你已经成功地在 Funtoo 上设置了默认语言。

Portage 设置

Portage 使用一个特殊的变量 L10N 来定义默认安装的本地化/翻译。默认情况下,L10N 是未设置的,它只构建软件包的默认语言。

可以通过在 /etc/portage/make.conf 中进行设置,自定义 L10N 的设置:

   /etc/portage/make.conf (bash source code)
# Install English (United States) and Chinese (China) translations (if available)
L10N="en-US zh-CN"

The LI10N variable should use spaces between each localization name. A list of all supported languages can be found in /usr/portage/profiles/desc/l10n.desc.

Some old packages still use the deprecated LINGUAS variable. You can set it in /etc/portage/make.conf:

   /etc/portage/make.conf (bash source code)
LINGUAS="en_US zh_CN"

It uses the same syntax, but uses other language codes which can be found in /usr/portage/profiles/desc/linguas.desc.

After setting the L10N and LINGUAS USE flags you may need to re-emerge some packages:

root # emerge --ask --newuse --deep --with-bdeps=y @world

阅读你的语言

A newly installed Funtoo Linux does not able to read all the languages. You want to read the stuff, say, in Mozilla Firefox. You need to install fonts - A good sign that you have not installed the proper fonts is that the following characters appear as boxes with numbers inside: 日本語フォント

Check if you have your language installed (Chinese) by using the fc-list command from the media-libs/fontconfig ebuild:

root # fc-list :lang=zh

If you are lucky, the right font will be installed, and your apps will also be able to use Chinese as the default language. But in case you not have the right font installed in this way, you need to install them manually.

For Japanese:

root # emerge media-fonts/kochi-substitute

For Chinese:

root # emerge media-fonts/arphicfonts

For Korean:

root # emerge media-fonts/baekmuk-fonts

A very good alternative could be a Noto Fonts by Google, claimed to be a fonts with widest language support:

root # emerge media-fonts/noto

Keymap

Funtoo Linux defaults to a US English keyboard. If you are using another type of keyboard, edit /etc/conf.d/keymaps and set keymap to your keyboard model. For example, cf for French Canadian keyboard, fr for French Azerty.

root # nano -w /etc/conf.d/keymaps

输入法

ibus is an Intelligent Input Bus for Linux.

root # emerge -av ibus

还需要安装 ibus 的语言表(中文)

root # emerge -av ibus-table-chinese