69

I want to switch to French locale. So I tried the below command:

myUbundu@myUbundu-desktop:~$ export LC_ALL=fr_FR

But I am getting the warning

-bash: warning: setlocale: LC_ALL: cannot change locale (fr_FR)

How to set the locale to French? Do I need to install additional packages?

1

6 Answers 6

61

Try the following commands

sudo locale-gen fr_FR
sudo update-locale LANG=fr_FR
4
  • 7
    sudo: locale-gen: command not found Do I need to install that tool? How?
    – dialex
    Aug 2, 2017 at 10:48
  • 1
    @DiAlex without the ':' after sudo Aug 23, 2017 at 22:45
  • 2
    @infoclogged He pasted the output indicating that he does not have the locale-gen installed. What is the package name for locale-gen is my question too.
    – dhill
    Oct 4, 2018 at 14:59
  • 2
    sudo apt install locales should do.
    – dibery
    May 5, 2022 at 3:36
40

I've had the same issue, and none of the answers worked, except dpkg-reconfigure locales. But it is too time consuming to do it this way. Just uncomment all the locales you need in /etc/locale.gen and run locale-gen. Or do it from the command line (as root):

echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
echo "fr_FR.UTF-8 UTF-8" >> /etc/locale.gen
locale-gen
4
  • 5
    Contrary to the other answer this worked for me as well.
    – user643011
    Dec 27, 2017 at 1:17
  • 2
    Contrary to the accepted answer, this also worked for me (Ubuntu 16-04) though I just looked in the locale.gen file and uncommented the locales I wanted.
    – Dark Star1
    Jan 8, 2019 at 15:11
  • 1
    Among all the answers (including the accepted one), this is the only one worked for me.
    – Gordon Bai
    Mar 28, 2021 at 15:05
  • 1
    same, i tried all the others, but this worked, thanks mate for getting the annoying error out
    – ASHu2
    Jul 3, 2023 at 6:16
15

I have fought with this for a week or so.

The most reliable (and easiest too) for me was to edit my profile file with

gedit ~/.profile

An add this language variables to be set at every login

LANG="en_AU.UTF-8"
LANGUAGE="en_AU:en"

You need to log out and back in for the change to take effect.

1
  • This also works from the command line, when you only want to change it for a certain time. Mar 31, 2017 at 12:06
3

Try installing language pack for French, e.g.

sudo apt-get install language-pack-fr

For any other language, run: check-language-support -l CODE to check the supported packages, e.g.

$ check-language-support -l fr
firefox-locale-fr gimp-help-fr hunspell-fr language-pack-fr language-pack-gnome-fr thunderbird-locale-fr wfrench

Check also: LC_ALL: cannot change locale.

2

UTF-8

Here is the UTF-8 version of the most voted answer.

I received the following error:

-bash: warning: setlocale: LC_ALL: cannot change locale (en_IE.UTF-8)

Issuing the following command sufficed to get rid of this bash warning:

$ sudo locale-gen en_IE.UTF-8

P.S.: The Irish locale en_IE.UTF-8 provides English language with euro € as a currency.

1
  • This works only if en_IE.UTF-8 is already specified in/etc/locale.gen. But since locale-gen does not accept (ignores) arguments you can issue sudo locale-gen w/o any arguments as long as your preferred locale is already listed in /etc/locale.gen. See @Alek_A answer for a more efficient approach
    – silverdr
    Mar 3 at 23:18
1

This system had this problem and none of the other solutions worked. After grepping around, .xsessionrc had defined corrupted values. Maybe some program created it and it shouldn't be there? Anyway, corrected to reflect system settings:

export LC_ALL=fr_FR.UTF-8
export LANG=fr_FR.UTF-8
export LANGUAGE=fr_FR.UTF-8

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .