个人工具

UbuntuHelp:UbuntuLTSP/LTSPLanguageSettings

来自Ubuntu中文

跳转至: 导航, 搜索
This page is specific to Ubuntu versions (?)

If you find this information applicable to additional versions/releases, please edit this page and modify this header to reflect that. Please also include any necessary modifications for this information to apply to the additional versions.


Gnome language

New languages can be installed with a graphical tool in System->Administration. It's possible to select the default (login) language for new users using this same tool.

LDM language

LTSP logins don't use GDM (Gnome Display Manager) at all. Instead LDM (Local Display Manager) is used. LDM's language settings are defined in /var/lib/tftpboot/ltsp/i386/lts.conf. LDM language affects the language of the users' X (Gnome) session. It's possible to define a different language for each thin client as seen below:

 [default]
 LDM_DIRECTX=True
 LOCALDEV=True
 LDM_LANGUAGE="fi_FI.UTF-8"
 
 [44:4d:50:e2:11:7f]
 LDM_DIRECTX=True
 LOCALDEV=True
 LDM_LANGUAGE="en_US.UTF-8"
 

Defining a locale here affects all locale-specific aspects of the X session. For example if en_US.UTF-8 is used, default paper format in OpenOffice will be letter instead of A4.

System files

The system-wide language settings are stored in the file /etc/default/locale. This file is parsed by various init.d scripts. The file /etc/environment contains similar settings.

OpenSSH language settings

OpenSSH does not have any language settings of it's own, but sometimes it's settings affect the user's effective locale settings. We'll use Ubuntu's SSH configuration as an example:

 # /etc/ssh/sshd_config
 AcceptEnv LANG LC_*

 # /etc/ssh/ssh_config
 SendEnv LANG LC_*
 

This means that by default Ubuntu SSH server accepts the LANG and LC_* environment variables from the SSH client. Ubuntu's SSH client also sends those variables to sshd by default. This has an effect only if bash or something else does not set the same variables. It's possible to run into trouble in following circumstances:

  • SSH server accepts the LANG and LC_* from the SSH client
  • SSH client does not pass the variables mentioned above
  • Bash does not set any language variables

In this case the language variables are not inherited from system defaults, but default to POSIX instead. This can be fixed by defining the language variables in Bash configuration (see below).

Bash-shell

Bash language settings override those sent by the SSH client (see SendEnv) above.

  • /etc/profile: system-wide Bash login shell settings
  • /etc/bash.bashrc: system-wide Bash shell settings (not for login shells)
  • $HOME/.bash_profile: per-user Bash login shell settings
  • $HOME/.bashrc: per-user Bash shell settings (not for login shells)

Regardless of the file you edit you need to add something like this it:

 export LC_ALL=fi_FI.UTF-8
 export LANG=fi_FI.UTF-8
 

This will take care of language settings in local shell logins and logins via SSH.