Localization/Guide/ja

標準時
現在位置に応じて、システム時間を維持するために、時間帯を設定する必要があります. OpenRCベースのシステムのためにこれを行うとベースのシステムにsystemdする方法手順は、システム時刻の記事で見つけることができます.

ロケールとは何ですか?
ロケールは、国や言語に特有の設定を決定するために使う情報の集合体で、大抵のプログラムがこれを利用します. ロケールとそのデータはシステムライブラリの一部であり、ほとんどのシステムにおいて にあります. ロケール名は一般に、 という形式で命名されます. ここで は2 (または3) 文字の言語コード (ISO-639で規定) であり、 は2 (または3) 文字の国コード (ISO-3166で規定) になります. 多くの場合、変形情報 (バリアント) がロケール名に追加されます. 例えば、 や です. ロケールと関連する記事をもっと読むには、Wikipedia (英語)を探してみてください.

ロケール関連の環境変数
ロケール設定の色々な側面を制御する環境変数を以下の表に示します. これらのすべては、上記の 形式で表記されたロケール名を1つだけ設定できます.

Most typically, users only set the LANG variable globally.

Generating specific locales
Most users will probably only use one or maybe two locales on their system. How additional locales can be specified is explained in the file.

The next step is to run. It will generate all the locales specified in the file and write them to the locale-archive.

Verify that the selected locales are available by running.

The file can be shown by.

Its raw content can be displayed using the command.

OpenRC
When using OpenRC locale settings are stored in environment variables. These are typically set in the (for system-wide settings) and  (for user-specific settings) file. More details can be found in the UTF-8 article. The system wide settings can be managed through. For instance, to set the LANG variable to the  value:

Of course, editing the file manually is possible as well to diversify the locale variables.

It's also possible, and pretty common especially in a more traditional UNIX environment, to leave the global settings unchanged, i.e. in the " " locale. Users can still specify their preferred locale in their own shell RC file:

Another way of configuring system is to leave it in the default C locale, but enable UTF-8 character representation at the same time. This option is achieved using the following settings in :

Using the above snippet, users will be able to see localized file names properly, while not being forced to completely use the selected language.

Once the right locale is set up, be sure to update the environment variables to make the system aware of the change.

For a system-wide default locale:

For a user-specific locale:

After this, kill the X server by pressing ++, log out, then log in as a user.

Now, verify that the changes have taken effect:

systemd
With systemd set the locale with the command. Check the list of available locales with:

Then set the desired locale:

Finally check if the result is good:

OpenRC
The keyboard layout used by the console is set in by the keymap variable. Valid values can be found in. has further subdivisions into layout (,, etc.). Some languages have multiple options - experiment with the various options to decide which one fits the needs best.

systemd
With systemd the keymap layout used for the console can be set using the command. First check the available keymap layouts:

Then set the requested console keymap layout:

Finally check if the console keymap layout was set correctly:

OpenRC
The keyboard layout to be used by the X server is specified in by the XkbLayout option. For details visit the Xorg guide and the article about Keyboard layout switching.

systemd
With systemd the keymap layout for the X11 server can be set using the command. First check the available X11 keymap layouts:

Then set the requested X11 keymap layout:

Finally check if the X11 keymap layout was set correctly:

NLS
For message based localization to work in programs that support it and have the (Native language support) USE flag, compile the programs with this flag set. Message strings are installed in files. Most of the programs using nls also need the gettext library to extract and use localized messages. Of course, Portage will automatically install it when needed.

After enabling the  USE flag some packages might need to be re-emerged:

LINGUAS
There is also an additional USE_EXPAND flag called LINGUAS, which affects the localization files that get installed in gettext-based programs, and decides which GUI language packs should be downloaded and installed for some specific software packages, such as Firefox, Thunderbird, kde-base/kde-l10n or app-office/libreoffice-l10n. The variable takes in space-separated list of language codes, and a suggested place to set it is :

With, most ebuilds would install only the packages' default language but none of the   files. They would also not download and install any of the further language packs. For instance, the currently stable app-office/libreoffice receives further language support through which supports download and installation of the language packs defined in. Since the origin language of libreoffice is, it does not have   flag in. So with, libreoffice still supports.

To see the status of GUI translation, hyphenation, spell checking and other localizations on the language, please refer to the LibreOffice translation web site.

For finer grained control the USE_EXPAND variables can be set per package in :

A list of installed programs making use of the LINGUAS USE_EXPAND flag and their supported languages can be shown as follows:

A list of LINGUAS values that can be used is provided as :

After setting the LINGUAS USE_EXPAND flag it may be necessary to re-emerge some packages:

参考

 * Configuring locales (Gentoo Handbooks)
 * Keyboard layout inside the Evdev article
 * X resources
 * The Euro symbol (€) for the console and in X

External resources

 * Locales and Internationalization (gnu.org)