Locale settings Ubuntu

From Teknologisk videncenter
Revision as of 07:30, 16 July 2024 by Heth (talk | contribs) (Created page with "Debian based system like Ubuntu, then the following should work. If you haven’t already, install the locales module on your system. <source lang=bash> sudo apt-get install...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Debian based system like Ubuntu, then the following should work.

If you haven’t already, install the locales module on your system.

sudo apt-get install locales
</aource>
Locate and edit the /etc/locale.gen file on your system. That will probably require administrator privileges. Find the locales you want to use, uncomment those lines and save.

Alternatively, you can use sed to edit the lines in-place, like this,
<source lang=bash>
sed -i 's/^# de_DE.UTF-8 UTF-8$/de_DE.UTF-8 UTF-8/g' /etc/locale.gen
sed -i 's/^# fr_FR.UTF-8 UTF-8$/fr_FR.UTF-8 UTF-8/g' /etc/locale.gen

for instance, to enable the French and German locale settings.

Run locale-gen to generate the locales you have chosen. For example, if you wish to have U.S. English, German and French enabled, you would do

locale-gen en_US.UTF-8 de_DE.UTF-8 fr_FR.UTF-8

Finally, update the locales. Here you don’t need to list them all, just the default one.

update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8

Links