57

I have a remote server which I installed and have been trying to unsuccessfully change the locale to french for a few hours. Below are the contents of my locale files:

/etc/default/locale:

LANG="fr_FR.UTF-8"
LANGUAGE="fr_FR.UTF-8"
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC="fr_FR.UTF-8"
LC_TIME="fr_FR.UTF-8"
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY="fr_FR.UTF-8"
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER="fr_FR.UTF-8"
LC_NAME="fr_FR.UTF-8"
LC_ADDRESS="fr_FR.UTF-8"
LC_TELEPHONE="fr_FR.UTF-8"
LC_MEASUREMENT="fr_FR.UTF-8"
LC_IDENTIFICATION="fr_FR.UTF-8"
LC_ALL="fr_FR.UTF-8

/var/lib/locales/supported.d/local:

fr_FR.UTF-8 UTF-8
en_US.UTF-8 UTF-8
en_GB ISO-8859-1
en_GB.UTF-8 UTF-8
en_GB.ISO-8859-15 ISO-8859-15
fr_BE.UTF-8 UTF-8
fr_CA.UTF-8 UTF-8
fr_CH.UTF-8 UTF-8
fr_LU.UTF-8 UTF-8
fr_FR ISO-8859-1

Everything is still defaulting to english dates and the $ currency in my web app. Is there something else I'm overlooking? I should also mention that I have dpkg re-configured and restarted the server after changes were made.

3 Answers 3

82

Run the command locale - it should show your current locale.

Generate the locales for french:

sudo locale-gen fr_FR
sudo locale-gen fr_FR.UTF-8

Also, try regenerating the supported locale list by running:

sudo dpkg-reconfigure locales

And update/change the current default locale:

sudo update-locale LANG=fr_FR.UTF-8

Update

Extra steps to try:

  1. Try:

    sudo update-locale LANG="fr_FR.UTF-8" LANGUAGE="fr_FR"
    sudo dpkg-reconfigure locales
    
  2. Perhaps adding LANG and LANGUAGE in /etc/environment could force a change. Try logout/login or rebooting.

  3. locale will show your current locale for the current user. Perhaps it's worth checking out these files just to be sure no local language variables are set: ~/.profile ~/.bashrc ~/.bash_profile

More info:

9
  • 1
    Jus a quick question. Does the system need to be restarted for changes to take effect?
    – Dark Star1
    Jan 19, 2012 at 11:41
  • 2
    I think a logout/login should do it Jan 20, 2012 at 0:57
  • 1
    try sudo update-locale LANG="fr_FR.UTF-8" LANGUAGE="fr_FR" and sudo dpkg-reconfigure locales. Finally, perhaps adding LANG and LANGUAGE in /etc/environment could force a change. Try rebooting, maybe it's required for server services. :) Jan 20, 2012 at 7:57
  • 1
    sudo update-locale var=locale and restart worked for me in ubuntu server 16.04.
    – Daniel
    Apr 29, 2016 at 16:33
  • 1
    @DarkStar1 About restarting the system, I had to restart. Apr 17, 2018 at 17:16
12

You also have to edit /etc/profile:

export LANG="en_US.utf8"
export LANGUAGE="en_US.utf8"
export LC_ALL="en_US.utf8"
1
  • Weird how few people mention this. Thanks! Aug 6, 2022 at 10:48
9

I tried everything from sudo locale-gen and sudo update-locale to sudo update-locale, and manually making entries in /etc/default/locale and /etc/environment with and without restarting.

Nothing seemed to work and my Python code was still throwing a Unicode error on Ubuntu 18.04l. Finally modifying the environment variable in ~/.bashrc worked.

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

Of course don't forget to source ~/.bashrc

I know it's not the recommended way, but nothing else worked for me.

2
  • Of course this then has to be done to every user's .bashrc and also be added to the skelton for new users.....
    – mckenzm
    May 23, 2019 at 4:13
  • 1
    All the above solutions didn't work only this one worked for my Elixir setup on Ubuntu 18 docker container. Thanks
    – xs2rashid
    Mar 18, 2020 at 16:42

You must log in to answer this question.

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