How do I add locale to ubuntu server?

I currently have those locales:

locale -a

C
en_AG
en_AG.utf8
en_AU.utf8
en_BW.utf8
en_CA.utf8
en_DK.utf8
en_GB.utf8
en_HK.utf8
en_IE.utf8
en_IN
en_IN.utf8
en_NG
en_NG.utf8
en_NZ.utf8
en_PH.utf8
en_SG.utf8
en_US.utf8
en_ZA.utf8
en_ZW.utf8
POSIX

How can I install ru_RU locale to my server?


Solution 1:

  1. Check which locales are supported:

    locale -a
    
  2. Add the locales you want (for example ru):

    sudo locale-gen ru_RU
    sudo locale-gen ru_RU.UTF-8
    
  3. Run this update command:

    sudo update-locale 
    

Solution 2:

I would go another route, which is IMO better suited to the Ubuntu style. Use the packages provided. There are packages for each locale, and they do all the work for you... no need to edit /var files, which I always believed were not meant to be edited manually.

sudo apt-get install language-pack-XX

where XX stands for the language code. Installing a language will install also all the country-specific variants (for example, installing language-pack-it will install it_CH.utf8 and it_IT.utf8, installing for NL will install nl_AW, nl_AW.utf8, nl_BE.utf8 and nl_NL.utf8).

Solution 3:

  1. check which locales are supported :

    less /usr/share/i18n/SUPPORTED
    
  2. Add locale to list of generated

    echo ru_RU.UTF8 >> /var/lib/locales/supported.d/local
    
  3. Regenerate list (it will invoke locale-gen...)

     sudo dpkg-reconfigure locales