30

I'm trying to have everything ready to install a new desktop with a few command line instructions. Unfortunately, to install the language packages, I couldn't find how to do it.

I can run

gnome-language-selector

But it doesn't seems to be usable in command line directly. I need to go on with clicks...

An other thing that could be done is that I do those clicks and find out which packages have been installed and read the changes in /etc/environment and /etc/default/locale (and other /etc/... file?) but the list of packages is probably different depending on the packages installed (Firefox, Thunderbird, LibreOffice, Gnome, ...)

Is there a tool for that? Like let's say :

gnome-language-selector --install fr

or a package that has all necessary dependencies :

sudo apt-get install super-language-pack-fr

Thanks,

samb
  • 1,306

4 Answers4

29

For desktop you can

sudo apt-get install language-pack-[cod] language-pack-gnome-[cod] language-pack-[cod]-base language-pack-gnome-[cod]-base 

But each applications can have its language pack. To know the packages to be installed try:

check-language-support -l [cod]

For example:

check-language-support -l fr
jasmines
  • 11,011
  • Thank you, but this doesn't install all that would be installed by gnome-language-selector; in my case : libreoffice-l10n-fr language-pack-gnome-fr language-pack-fr-base hunspell-fr language-pack-gnome-fr-base firefox-locale-fr mythes-fr libreoffice-help-fr hyphen-fr wfrench language-pack-fr thunderbird-locale-fr – samb Jun 12 '12 at 14:49
  • There are no language-support-writing-[cod] package available for 12.04 ... It disappeared with 11.10. – samb Jun 12 '12 at 14:55
  • 1
    Edited. Please, check if the last additions are useful...:) – jasmines Jun 12 '12 at 15:17
  • 1
    Excellent! The final command is

    sudo apt-get install $(check-language-support -l fr)

    – samb Jun 12 '12 at 15:51
  • 1
    Or yes | sudo apt-get install \check-language-support -l fr`` – Reinier Post Jun 18 '13 at 19:52
  • How can one find the two-letter code for a given language? – MRule Dec 31 '21 at 13:45
18

Auto install all dependencies:

sudo apt -y install $(check-language-support -l fr)

Where fr is the desired two-letter (ISO 639-1) language code.

Pablo Bianchi
  • 15,657
Nuno Mourinho
  • 181
  • 1
  • 2
5

First, you need to edit the locale.gen file.

sudo vim /etc/locale.gen

Then looking for the language pack you need and remove the comment mark, for example, if I want to install zh_CN.GBK GBK zh_CN.UTF8, I just remove the # symbol in these lines, alternatively, you can also add your lines directly into the file. Finally, run:

sudo locale-gen

This is the simplest way I found online.

Gary
  • 51
0

To add french language to Ubuntu using the Software Center:

Install via the software center

Quoted from there:

This metapackage depends on all packages that provide native language support for applications. (like spell checkers, dictionaries, OpenOffice and Mozilla locale packages, etc.).

If you also want your applications and the desktop to be translated, please additionally install language-pack-fr.

So it may not have the language for certain programs.


To add a language to Ubuntu using the Command line:

Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the commands below.

sudo apt-get install language-support-fr
Mitch
  • 107,631
  • Thank you, but this doesn't install all that would be installed by gnome-language-selector; in my case : libreoffice-l10n-fr language-pack-gnome-fr language-pack-fr-base hunspell-fr language-pack-gnome-fr-base firefox-locale-fr mythes-fr libreoffice-help-fr hyphen-fr wfrench language-pack-fr thunderbird-locale-fr – samb Jun 12 '12 at 14:49