Use Ubuntu language packs. All supported languages are available in default repositories:
apt-cache search language-pack
A full example of locale switching in Ubuntu (server) version:
jani@example:~$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.1 LTS"
All available (i.e. already installed) locales can be listed with:
locale -a
My current locale is en_IE
:
jani@example:~$ locale
LANG=en_IE.UTF-8
LANGUAGE=
LC_CTYPE="en_IE.UTF-8"
LC_NUMERIC="en_IE.UTF-8"
LC_TIME="en_IE.UTF-8"
LC_COLLATE="en_IE.UTF-8"
LC_MONETARY="en_IE.UTF-8"
LC_MESSAGES=POSIX
LC_PAPER="en_IE.UTF-8"
LC_NAME="en_IE.UTF-8"
LC_ADDRESS="en_IE.UTF-8"
LC_TELEPHONE="en_IE.UTF-8"
LC_MEASUREMENT="en_IE.UTF-8"
LC_IDENTIFICATION="en_IE.UTF-8"
LC_ALL=
jani@example:~$ date
Sat Nov 1 15:36:51 UTC 2014
jani@example:~$
Because I didn't have ru locales I have to install ru language pack:
jani@example:~$ sudo apt-get -y install language-pack-ru
[..]
Generating locales...
ru_RU.UTF-8... done
ru_UA.UTF-8... done
Generation complete.
jani@example:~$
Now the ru locales are available. The system default locale is set by editing /etc/default/locale
:
jani@example:~$ sudo vi /etc/default/locale
# Created by cloud-init v. 0.7.5 on Mon, 27 Oct 2014 18:46:13 +0000
LANG="ru_RU.UTF-8"
LC_MESSAGES=POSIX
jani@example:~$
Re-login and check your brand new locale:
jani@example:~$ locale
LANG=ru_RU.UTF-8
LANGUAGE=
LC_CTYPE="ru_RU.UTF-8"
LC_NUMERIC="ru_RU.UTF-8"
LC_TIME="ru_RU.UTF-8"
LC_COLLATE="ru_RU.UTF-8"
LC_MONETARY="ru_RU.UTF-8"
LC_MESSAGES=POSIX
LC_PAPER="ru_RU.UTF-8"
LC_NAME="ru_RU.UTF-8"
LC_ADDRESS="ru_RU.UTF-8"
LC_TELEPHONE="ru_RU.UTF-8"
LC_MEASUREMENT="ru_RU.UTF-8"
LC_IDENTIFICATION="ru_RU.UTF-8"
LC_ALL=
jani@example:~$ date
Сб. нояб. 1 15:43:45 UTC 2014
jani@example:~$
sudo update-locale
– Justin Force Mar 14 '13 at 23:05ru_RU
andru_RU.UTF-8
needed? I don't know much about locales. – Sopalajo de Arrierez Mar 03 '15 at 22:16sudo service php5-fpm restart
– Stalinko Apr 26 '15 at 08:17locale-gen
without the codeset generates, by default, ISO-8859-1. – igorsantos07 May 03 '16 at 07:09setlocale
and I also had to restart my VM for it to take effect. – totymedli Mar 28 '18 at 04:55sudo locale-gen ru_RU.UTF-8
does nothing for me. As an alternative, one could go and manually edit filevi /etc/locale.gen
to uncomment desired locales. – The Godfather Aug 06 '18 at 12:34locale-gen
is part of thelocalehelper
package; if it's also missing. – rvalue Mar 14 '20 at 02:42update-locale
... does what exactly? For me it generated a file with a comment. Depending on the release, you've got to either dolocale-gen en_US.utf8
, or edit/etc/locale.gen
and dolocale-gen
. Also you might want to change/export the LANG variable.dpkg-reconfigure locales
seems to runlocale-gen
, at least on trusty. For what it's worth. – x-yuri Jun 10 '21 at 15:30