Locale
Содержание:
Abilitare il Locale necessario
Prima che un locale possa essere utilizzato nel sistema, deve essere attivato. Per elencare tutte le versioni locali disponibili, utilizzare il comando:
$ locale -a
Per abilitare un locale, decommentare il nome del locale nel file . Questo file contiene tutte le variabili locali che possono essere utilizzati sul sistema. Ripristinare il processo per disabilitare un locale. Dopo che i locali necessari sono abilitati, il sistema deve essere aggiornato con le nuove impostazioni locali:
# locale-gen
Per mostrare i locale che sono attualmente in uso, digitare:
$ locale
Suggerimento: Anche se è molto probabile che una sola lingua è utilizzata sul vostro computer, può essere utile o addirittura necessario consentire anche altri locali. Se si sta eseguendo un sistema multi-utente, con gli utenti che non parlano inglese, il loro locale individuale dovrebbe almeno essere supportata dal sistema.
Esempio IT Italiano
Per prima cosa decommentare il seguente locale in :
it_IT.UTF-8 UTF-8
Successivamente aggiornare il sistema come root:
# locale-gen
Переменные окружения
Файлы могут содержать следующие переменные окружения:
LANG: локаль по умолчанию
Локаль, установленная в этой переменной используется в качестве значения для всех остальных -переменных, которые не установлены явно.
locale.conf
LANG=en_AU LANGUAGE=en_AU:en_GB:en
LC_TIME: формат даты и времени
Например, если переменная имеет значение , будет использован формат даты . Если вы хотите использовать формат ISO 8601 (), установите:
locale.conf
LC_TIME=en_DK.UTF-8
LC_COLLATE: порядок сортировки
Эта переменная отвечает за правила определения сравнения наборов символов, которые используются для сортировки и регулярных выражений.
Установка значения , например, приведет к тому, что команда ls будет располагать файлы, имена которых начинаются с точки, первыми, за ними последуют имена, начинающиеся с цифры, затем с заглавной и, наконец, со строчной буквы:
/etc/locale.conf
LC_COLLATE=C
Чтобы избежать возможных проблем, в Arch переменная установлена как в , однако этот метод сейчас устарел.
Activar el «locale» necesario
Antes de que un locale puede utilizarse en el sistema, tiene que ser activado primero. Para mostrar una lista de todos las versiones locales disponibles, utilice la orden:
$ locale -a
Para habilitar un locale, descomente el nombre del locale en el archivo . Este archivo contiene todos los locales disponibles que se pueden utilizar en el sistema. El proceso es reversible deshabilitando (comentando) el locale. Después de que los locales necesarios están habilitados, el sistema necesita ser actualizado con las nuevas configuraciones regionales:
# locale-gen
Para mostrar ahora los locales actualmente en uso, escriba:
$ locale
Sugerencia: Aunque lo más probable es que se utilice un solo idioma en su máquina, puede ser útil o incluso necesario habilitar otros locales también. Si usted está funcionando en un sistema multi-usuario con usuarios que no hablan, por ejemplo, en_US, sus otros locales personales deben, del mismo modo, ser soportados en su sistema.
Ejemplo ES Español
Primero descomente los locales siguientes en :
es_ES.UTF-8 UTF-8
A continuación, actualice el sistema como root:
# locale-gen
Adjusting Locales
The default settings are stored in the file.
$ cat /etc/default/locale LANG=en_US.UTF-8
This file can either be adjusted manually or updated using the tool, .
# update-locale LANG=de_DE.UTF-8
You will find a list of all LC_* environment variables at .
This becomes useful for example, when a system should be operated in German, however the error and system messages should be displayed in English. This is often helpful, when searching for errors. In this case, the following settings can be made to :
LANG=de_DE.UTF-8 LC_MESSAGES=POSIX
The variable also influences the language of the user interface or the window manager. Date and number specifications are not affected by a change from .
Input methods
The following input methods are available for Korean:
- for Fcitx
- for IBus
- AUR for SCIM
- uim-byeoru of uim
- Nimf
Configuration
Nabi
Install the AUR package.
Once you have finished the installation, add the following to xprofile, xinitrc, or :
export XIM=nabi export XIM_ARGS= export XIM_PROGRAM="nabi" export XMODIFIERS="@im=nabi" export GTK_IM_MODULE=xim export QT_IM_MODULE=xim
Once you restart the X session, nabi will autostart by default. The default Korean keyboard layout is Dubeolsik(두벌식). If you need a different Korean keyboard layout (e.g. Sebeolsik or Dubeolsik Yetgul), click on the system tray icon of nabi, and select a input method from the menu that pops up.
scim-hangul
Install AUR.
Now add the following to the user’s , , or :
export XMODIFIERS=@im=SCIM export GTK_IM_MODULE="xim" export QT_IM_MODULE="scim" scim -d
Note: The above environment variables differ slightly from the ones recommended in the scim article. We are adding instead of . This allows us to input Korean in apps such as Chrome and Chromium (though with issues discussed above), and to use backspace properly in GTK3 applications such as gedit.
uim-byeoru
Follow the instructions in User:Isaac914/uim to install uim and to get it running. Return to this section after uim is installed and running as the default input method.
Open the uim preferences window by running :
$ uim-pref-gtk (Or, uim-pref-gtk3/uim-pref-qt4)
Within global settings, check on the Specify default IM checkbox. Then, set Byeoru as default. You may also want to disable input methods that you do not plan on using by clicking on the ‘edit’ button. If you want to quickly switch between Korean and other languages (other than English), check the enable IM switching by hotkey checkbox, and set a hotkey to switch between enabled IMEs.
When you are done with the global preferences, find Byeoru in the tree menu on the left side of the preferences window. From there, you can set the Korean keyboard layout you want to use (e.g. ), specify the korean/Hanja dictionary that Byeoru will use, and other miscellaneous settings. Then, click on Byeoru Keybinding 1 in the tree menu. Set the hotkey you want to use to enable/disable Byeoru. Most Korean users use or .
Note: If you want to use the right key to switch from Korean to English and vice versa, go to the section.
If all went properly, you should now be able to use UIM-byeoru to type in Korean.
Troubleshooting
The factual accuracy of this article or section is disputed.
- IBus
- As of November 2014, IBus sometimes doesn’t recognize user-set hotkeys for IM switching. This means that you may need to click on the IBus systray icon every time to want to switch input methods.
- uim
- uim-byeoru may cause Opera to crash.
- scim
- scim-hangul, as of November 2014, has issues with Google Chrome and Chromium web browsers. With the default environment variables, you cannot input Korean in Google Chrome or Chromium. scim also causes problems in Gedit as of November 2014. When scim-hangul is active, pressing does not work properly. A workaround for both these issues will be explained in . However, even with this workaround applied, Chrome/Chromium users may find that the preedit string disappears when the spacebar or any other modifier key is pressed. There is currently no known workaround for this issue.
- fcitx
- Fcitx-hangul has issues with Google Chrome and Chromium. Some users have reported that fcitx only recognizes Google Chrome/Chromium’s URL bar as an input window only after their themes have been changed.
- nabi
- AUR is a standalone Korean input method that is being developed by Choehwanjin. Nabi provides many unique features, such as Yethangul support. If you only need to use Korean and English input, you may want to install nabi. Currently, nabi causes an issue with chromium. When you press the spacebar, the preedit string will be placed after the space, causing your input to look like this:
Libreoffice
In some cases, Libreoffice will not take Korean input from any input method. To resolve this issue, try adding to , , or .
Tips and Tricks
Using the Right alt key to switch input methods
You can use the right key (e.g. ‘한/영키’) to switch between Input methods if you are using uim, scim, or nabi. To do this, add the following lines after the environment variables that start your input method:
~/.xprofile
xmodmap -e 'remove mod1 = Alt_R' xmodmap -e 'keycode 108 = Hangul' xmodmap -e 'remove control = Control_R' xmodmap -e 'keycode 105 = Hangul_Hanja'
1. Check the current system locale on Debian 9
The first thing you need to do is to connect to your Linux server via SSH. You can log in as root or if you have a system user with sudo privileges you can log in as that user. Once you log in, run the following command to check the current system locale:
locale
The output should be similar to the one below:
# locale LANG= LANGUAGE= LC_CTYPE="en_US.UTF-8" LC_NUMERIC="en_US.UTF-8" LC_TIME="en_US.UTF-8" LC_COLLATE="en_US.UTF-8" LC_MONETARY="en_US.UTF-8" LC_MESSAGES="en_US.UTF-8" LC_PAPER="en_US.UTF-8" LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT="en_US.UTF-8" LC_IDENTIFICATION="en_US.UTF-8" LC_ALL=en_US.UTF-8
Configuración de locales de usuarios
Como mencionamos anteriormente, algunos usuarios podrían querer definir una configuración regional distinta a la definida de forma global para todo el sistema.
Establecer la configuración regional en el archivo de inicio de la shell
Para ello, exporte la variable con el local especificado al archivo . Por ejemplo, para utilizar el locale :
export LANG=es_ES.UTF-8
Los locales se actualizarán la próxima vez que sea leído . Puede actualizar, ya sea reiniciando sesión o de forma manual:
$ source ~/.bashrc
Establecer la configuración regional en
El script sobrescribe la configuración regional para todo el sistema con la que se encuentra en , si existe. Este archivo no existe de forma predeterminada, con lo que habrá que crearlo y poner la configuración regional del idioma deseado.
$HOME/.config/locale.conf
LANG="es_ES.UTF-8" LANGUAGE="es_ES.UTF-8"
Solução de problemas
Meu terminal não possui suporte a UTF-8
A lista a seguir mostra alguns (não todos) terminais que oferecem suporte a UTF-8:
- gnustep-terminal
- konsole
- mlterm
- rxvt-unicode
- st
- termite
- xterm — Execute com o argumento ou configure o recurso .
Gnome-terminal ou rxvt-unicode
Você precisa iniciar esses aplicativos a partir de um locale UTF-8 ou eles não terão suporte a UTF-8. Habilite o locale (ou sua alternativa UTF-8 local) com as instruções acima e configure-o como o locale padrão, então reinicie.
Meu sistema ainda está usando o idioma errado
É possível que as variáveis de ambiente sejam redefinidas em outros arquivos além de , por exemplo . Veja para detalhes.
Se você está usando um ambiente gráfico, como o GNOME, suas configurações de idioma podem estar sobrescrevendo as configurações em .