- Locale
- Configuration
- Standard
- SSH Server
- SSH Client
- Manually
- First day of week
- Measuring units and paper size
- Keyboard layout
- See Also
- ChangeLanguage
- How to change the language of your Debian system
- Change the Language of Your Debian 8 System From English to Chinese
- Change the Language of Your Debian 8 System
- How to install/change locale on Debian?
- 8 Answers 8
- Basic info
- Checking locales and the locale
- Setting and generating (new) locales
- Removing locales
- Setting the locale
- Locale
This page indicates how to install/use Debian in your local language.
Configuration
Programs that support local technology use environment variables to determine the conventions to use for date and time formatting, character display, currency display and codepage selection.
The following environment variables affect locale related behaviour of the system:
Determines the default locale in the absence of other locale related environment variables
List of fallback message translation languages (GNU only)
LC_ADDRESS
Convention used for formatting of street or postal addresses
Overrides all other locale variables (except LANGUAGE)
LC_COLLATE
Collation order
LC_CTYPE
Character classification and case conversion
LC_MONETARY
Monetary formatting
LC_MEASUREMENT
Default measurement system used within the region
LC_MESSAGES
Format of interactive words and responses
LC_NUMERIC
Numeric formatting
LC_PAPER
Default paper size for region
LC_RESPONSE
Determines how responses (such as Yes and No) appear in the local language
LC_TELEPHONE
Conventions used for representation of telephone numbers
Date and time formats
Warning!
Using LC_ALL is strongly discouraged as it overrides everything. Please use it only when testing and never set it in a startup file.
Normally how it works is you set LANG to your preferred locale. If there are specific aspects of your primary locale that you don’t like (e.g. date formats), then you set the specific variables to override those features only. End users should never set LC_ALL, at least not permanently. LC_ALL is reserved for programs or situations where you need to enforce a specific locale (usually «C») on a temporary basis. One example of this would be reporting error messages on an English-speaking mailing list; you can use LC_ALL=C your command to ensure that the errors are in English, and follow all the POSIX norms.
Standard
Get root and type dpkg-reconfigure locales and select the locale(s) you want to generate. At the end, you’ll be asked which one should be the default. If you have users who access the system through ssh, it is recommended that you choose None as your default locale.
This changes /etc/default/locale and /etc/locale.gen (in older versions of Debian, also /etc/environment). If you chose a default locale other than None above, it will be in /etc/default/locale and will override the LANG variable supplied by ssh. This is highly inconvenient.
If you’ve upgraded to Lenny from an older version of Debian and have leftover LANG=. content in /etc/environment, you should comment it out (type editor /etc/environment and put a # character in front of the line, and then save it).
Now, optionally, edit /etc/profile as follows:
Run locale -a to get a list of the locale names suitable for use in environment variables. Note that the spellings are different from the ones presented in the dpkg-reconfigure list.
Add a line like this to your /etc/profile file:
where de_DE.iso88591 is the locale you want to use as a default. If you have tcsh or csh users, create a file named /etc/csh/login.d/lang with the following content:
This will only set LANG if it was not previously defined, for example by ssh. Unfortunately, this won’t affect users who login with xdm, gdm, etc.
SSH Server
If you’ve upgraded from a very old version of Debian (before Etch), your sshd_config(5) may not contain the correct AcceptEnv directive to let the ssh client pass locale variables. Edit your /etc/ssh/sshd_config file and make sure it contains this line:
Then restart the ssh service to make it take effect. Also, you should log out of your current ssh connection and log back in. Already-running programs will not be affected.
SSH Client
If you’ve upgraded from a very old version of Debian (before Etch), your ssh_config(5) may not contain the correct SendEnv directive to let the ssh client pass locale variables. Edit your /etc/ssh/ssh_config file and make sure it contains this line:
You should log out current ssh connection and log back in. Already-running session will not be affected.
In GDM login screen, pick a proper locale from the list of installed locales by clicking the locale button in the bottom of the screen.
/.dmrc. For example, to set the user-wide locale to en_DK.utf8,
/.dmrc could be something like this:
Manually
Edit the file /etc/locale.gen and add your locale settings (one set per line), e.g.:
The supported locales are listed in /usr/share/i18n/SUPPORTED.
Run the command locale-gen
Run the command locale -a to verify the list of available locales; note that the spellings change.
If you’ve upgraded to Lenny and you have leftover LANG=. content in /etc/environment, you should comment it out.
First day of week
You might want to use the default en_US locale because some software doesn’t play nice when locale’s set to something else, but you want to have the first day of the week set to Monday, not to Sunday, like it’s defined in en_US. To get this desired behaviour you can add the following to /etc/default/locale:
Measuring units and paper size
You might also want to change the measuring units and the paper size if you’re from Europe:
Keyboard layout
See Also
ReduceDebian — Reducing the number of installed locales
Источник
- ChangeLanguage
How to change the language of your Debian system
* First, you have to set EnvironmentVariables such as LANG, LANGUAGE, LC_CTYPE, LC_MESSAGES to your local language. Usually LANG (or LC_ALL) is sufficient.
To do this, first open up the terminal and check what you have at present with the following command:
* Second, you may also need to reconfigure your locales.
To do this, as root:
First: issue on a root terminal #export LANG=(two letter code for your language)_(two letter code for your country).UTF-8
For the Spanish language it would be:
How do I know the 2 letter code for my language?
This page on wikipedia is helpful to help you determine this. You can see the fourth column on the table, for example Japanese will be ‘ja’.
How do I know the 2 letter code for my country?
This website allows you to search this (remember to select Country Codes at the end). Upon searching Japan,you will get ‘JP’.
So if you wanted to export Japanese, it would be ja_JP.UTF-8.
Second: reconfigure locales issuing the following command:
A window will ask you to select the languages (you select with SPACE) you want to have available. Choose your own.
Changes may not show immediately, a reboot will be needed.
How to change the language of KDE applications
Show available languages:( DebSearch:kde-l10n )
Change the language:
as an example (for german ‘de’utschland) :
Now you have your language in all KDE applications!
Источник
Change the Language of Your Debian 8 System From English to Chinese
Hello, Linux fellas. In this tutorial, I will show you how to change the language of your Debian 8 system from English to Chinese.
Change the Language of Your Debian 8 System
Open your terminal and login as root.
Edit /etc/locale.gen file
If you chose American English as the system language during the installation process, you will see in this file that only the 151th line: en_US.UTF-8 UTF-8 is not commented.
To add simplified Chinese language support, remove those pound sign from lines that start with zh_CN.
Save and close the file. Now run the following command:
Now open Gnome settings panel, select Region & Lanuage.
Double click the language field.
Choose Chinese(汉语) from the list and click Done button.
Now log out of Debian and log back in. You will greeted by the following message.
It asks you if you want to change the language of your standard folders (the folders under your home) to Chinese as well. You will want to use English as the language for these folders. So click the left button to preserve their original name.
Now the system language of Debian is Chinese, but additionally we need to add Chinese language support for iceweasal, icedove, libreoffice and other applications. These applications require specific language packs. Run the following command to install these Chinese language packs.
Источник
How to install/change locale on Debian?
I’ve written a web application for which the user interface is in Dutch. I use the system’s date and time routines to format date strings in the application. However, the date strings that the system formats are in English but I want them in Dutch, so I need to set the system’s locale. How do I do that on Debian? I tried setting LC_ALL=nl_NL but it doesn’t seem to have any effect:
I remember that setting LC_ALL on my Ubuntu desktop system works fine. Do I need to install extra packages to make this work, or am I doing it entirely wrong?
8 Answers 8
Edit /etc/default/locale and set the contents to:
You can check which locales you currently have generated using:
You can generate more by editing /etc/locale.gen and uncommenting the lines for the locales that you want to enable. Then you can generate them by running the command:
You can find a list of supported locales in /usr/share/i18n/SUPPORTED
There is more information available on the Debian wiki.
You may need to install the locales package. This will ask you which locales to generate. If it’s already installed, then dpkg-reconfigure locales will let you generate more locales.
Answers here are incomplete as with most elsewhere. After piecing together information from a few places, what worked for me was to (1) make sure the locale I wanted was available (generate it if it wasn’t) then (2) set locale related environment variables to desired locale.
In my case I needed en_US.UTF-8 programmatically (i.e. non-interactively) installed in a docker container. The ff accomplished what I need but it should work just fine in an interactive shell.
On the same shell, you will need to do source
/.bashrc for the env vars to take effect immediately. You can check that locale has been configured correctly by invoking locale .
There were a lot of Q&A entries regarding this subject but only a few were actually helpful. Credit where credit is due:
/.bashrc , I did update-locale LANG=en_US.utf8 as root user to set system-wide locale to new users.
None of these answers worked for me, on an LXC container installed with:
I always got the following output from locale-gen , i.e. not generating any locales (none listed):
Running dpkg-reconfigure locales and selecting some locales did not update /etc/locale.gen as I expected it to.
However, when I modified that file manually and uncommented the locales that I wanted, then locale-gen started working properly:
I was also able to generate locales manually like this:
But this was not a permanent solution: I found that running locale-gen without the —keep-existing option will delete all such manually-generated locales, i.e. every locale not listed (and uncommented) in /etc/locale.gen .
For a web application, it might be better to use setlocale() inside the program, rather than requiring that the system default locale be set appropriately outside. Less loose ends that way.
For those who, like me, on Ubuntu 14.04 LTS, have, somehow, no /etc/locale.gen file, you can add a new locale in /var/lib/locales/supported.d/local and then run :
sudo dpkg-reconfigure locales
You can also add the french (for example) locale this way (instead of editing /var/lib/locales/supported.d/local ) :
sudo locale-gen fr_FR fr_FR.UTF-8
to add and generate the ISO-8859-1 and UTF-8 codesets of the fr_FR locale and finally type :
sudo dpkg-reconfigure locales
to finish the job
But first you need to have needed language pack installed. On my German based VPS there was no english language pack pre-installed. So first you check that you have it installed:
Note: Some of the commands below require root privileges, consider the use of sudo .
Basic info
According to man locale-gen , locales are set in several files.
The main configuration file, which has a simple format: every line that is not empty and does not begin with a # is treated as a locale definition that is to be built.
A directory containing locale.gen snippets provided by language-pack packages. Do not edit these manually, they will be overwritten on package upgrades.
Comprehensive details on locales at the Arch Wiki.
Checking locales and the locale
To check the (already) generated locales, run any of the following commands (with minor output differences).
To check the currently used locale, run any of the following commands (with minor output differences).
Setting and generating (new) locales
Locales are typically set by uncommenting lines in /etc/locale.gen , after which running locale-gen is required.
This will generate locales files for each uncommented line in /etc/locale.gen (and under /var/lib/locales/supported.d/ ), whether they were previously generated or not.
Alternatively, the command
will uncomment the corresponding line in locale-gen while generating the desired locale and only this one.
Removing locales
To remove locales in /etc/locale.gen , simply comment the desired lines and regenerate the locales using locale-gen . The command locale-gen —purge doesn’t do what the modifier suggests.
To remove locales under /var/lib/locales/supported.d/ is trickier. Since any file /var/lib/locales/supported.d/ depends on the package language-pack- -base , any change on the former will be restored when the latter is updated.
Workaround. To prevent changes under /var/lib/locales/supported.d/ , set files in it with the «immutable (i)» attribute. So instead of removing files, empty them. For instance:
Setting the locale
Setting and generating locales does not set the system locale. Any of the following commands achieves this.
Источник