Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

How do I set up a global locale for the computer?

I have recently installed Kubuntu 14.04LTS in english but since I am in Spain, I chose Spain as a country and then changed locale options so that I get all country specific configuration such as digit grouping, decimal separator, date format, etc. I also added the spanish language.

Now all applications complain that locale is wrong. check-language-support tells me I'm using en_ES.UTF-8 as system's locale, and that locale is indeed wrong, there is no locale for english language in Spain.

I tried using Kubuntu's country/region & language settings but it doesn't fix it. I tried using export LANG=en_GB.UTF-8 and export LC_ALL=en_GB.UTF-8 and then sudo dpkg-reconfigure locales and that caused check-language-support to say that I now have a correct configuration but if it is, it's only in that konsole session. This problem also prevents konsole from showing unicode characters and I cannot use dead keys or enter any 'international character' such as ñ or ç (those work on other applications such as Firefox, that I'm using to post this question).

So the question is: How do I set up a global locale for the computer?

This is not a bug report, I will probably reinstall my computer eventually if I can't fix it. But I really want to know how I can perform this REALLY basic task.

Thank you.

$ check-language-support
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en:es:en",
        LC_ALL = (unset),
        LC_PAPER = "en_ES.UTF-8",
        LC_ADDRESS = "en_ES.UTF-8",
        LC_MONETARY = "en_ES.UTF-8",
        LC_NUMERIC = "en_ES.UTF-8",
        LC_TELEPHONE = "en_ES.UTF-8",
        LC_IDENTIFICATION = "en_ES.UTF-8",
        LC_MEASUREMENT = "en_ES.UTF-8",
        LC_TIME = "en_ES.UTF-8",
        LC_NAME = "en_ES.UTF-8",
        LANG = "en_ES.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_COLLATE to default locale: No such file or directory
hunspell-en-ca libreoffice-help-en-gb libreoffice-l10n-en-gb libreoffice-l10n-en-za mythes-en-au wspanish

$ cat /etc/default/locale
LANG="en_US.UTF-8"
LC_NUMERIC="es_ES.UTF-8"
LC_TIME="es_ES.UTF-8"
LC_MONETARY="es_ES.UTF-8"
LC_PAPER="es_ES.UTF-8"
LC_NAME="es_ES.UTF-8"
LC_ADDRESS="es_ES.UTF-8"
LC_TELEPHONE="es_ES.UTF-8"
LC_MEASUREMENT="es_ES.UTF-8"
LC_IDENTIFICATION="es_ES.UTF-8"


$ locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_ES.UTF-8
LANGUAGE=en:es:en
LC_CTYPE="en_ES.UTF-8"
LC_NUMERIC=en_ES.UTF-8
LC_TIME=en_ES.UTF-8
LC_COLLATE="en_ES.UTF-8"
LC_MONETARY=en_ES.UTF-8
LC_MESSAGES="en_ES.UTF-8"
LC_PAPER=en_ES.UTF-8
LC_NAME=en_ES.UTF-8
LC_ADDRESS=en_ES.UTF-8
LC_TELEPHONE=en_ES.UTF-8
LC_MEASUREMENT=en_ES.UTF-8
LC_IDENTIFICATION=en_ES.UTF-8
LC_ALL=
$ update-locale
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en:es:en",
        LC_ALL = (unset),
        LC_PAPER = "en_ES.UTF-8",
        LC_ADDRESS = "en_ES.UTF-8",
        LC_MONETARY = "en_ES.UTF-8",
        LC_NUMERIC = "en_ES.UTF-8",
        LC_TELEPHONE = "en_ES.UTF-8",
        LC_IDENTIFICATION = "en_ES.UTF-8",
        LC_MEASUREMENT = "en_ES.UTF-8",
        LC_TIME = "en_ES.UTF-8",
        LC_NAME = "en_ES.UTF-8",
        LANG = "en_ES.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
share|improve this question

6 Answers 6

up vote 4 down vote accepted

Bug is reported here: https://bugs.launchpad.net/ubuntu/+source/kde-runtime/+bug/1322968 - "Changing country leads to invalid locale"

Workarounds:

  1. Select country British English - not American English (and then language Spain)
  2. Or manually edit ~/.kde/env/setlocale.sh after having changed Country/Region & Language settings
share|improve this answer
    
Thank you Freddy! –  dotancohen Nov 9 '14 at 9:39

I've solved this problem following the steps below. I've been studying how locales work and the different configuration sets between some distributions (Debian Based originally).

I use Linux Mint as my primary system distribution and Debian as my system servers.

Despite the fact Ubuntu is derived from Debian, the locale settings are slightly different.

1) Verify which locales are installed and generated in your system:

sudo locale -a

2) remove undesired locales using the following command:

sudo localedef --delete-from-archive <YOUR DESIRED LOCALE HERE>

for example:

sudo localedef --delete-from-archive en_AG

The default configuration located in /etc/default/locale is overriden by the personal (local user only) settings generated by the System Language App. These settings are located in $HOME/.pam_environment ($HOME = The location of your home folder).

Empty this file and write the configurations you may need.

My .pam_environment file:

LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_NUMERIC=pt_BR.UTF-8
LC_TIME=pt_BR.UTF-8
LC_MONETARY=pt_BR.UTF-8
LC_PAPER=pt_BR.UTF-8
LC_IDENTIFICATION=pt_BR.UTF-8
LC_NAME=pt_BR.UTF-8
LC_ADDRESS=pt_BR.UTF-8
LC_TELEPHONE=pt_BR.UTF-8
LC_MEASUREMENT=pt_BR.UTF-8
LC_CTYPE=pt_BR.UTF-8

The LANG variable sets the non configured LC_* to the value set configured there. For example:

If the system makes a lookup for the LC_TIME variable, and it is not set, it will use the LANG value as default for that variable (LC_TIME in this case).

My .pam_environment basically says: set almost all variables to pt_BR.UTF-8 and the system language to english.

I hope this information may be userful.

share|improve this answer

You will want to use the update-locale command. Visit that page on how to use it. You basically run it (with sudo) with arguments setting the locale how you wish it to be. This "Modif[ies] global locale settings" to your requirements.

Edit 1: You may also look into locale-gen if the previous does not work for you.

share|improve this answer
    
Thank you. I already tried that. dpkg-reconfigure locales generated all possible combinations for english and spanish. It seems to call locale-gen for all installed languages combinations. I also called locale-gen for several locales just in case. The problem is that en_ES doesn't exist –  Calabacin Jul 22 '14 at 16:14
    
Very well, I will keep looking for solutions. I haven't seen a problem like this in a long time. –  Zzzach... Jul 22 '14 at 16:59

Like Freddy Vulto commented in his answer, this is a known bug reported here: https://bugs.launchpad.net/ubuntu/+source/kde-runtime/+bug/1322968

Please take a look at it that bug report if you need to fix it manually. It can be fixed calling ~/.kde/env/setlocale.sh (possibly after modifying), among other possible fixes.

share|improve this answer

I managed to temporarily fix the issue by changing the system language from American English to British English as suggested above. I did it via the KDE System Settings > Locale > Languages dialog. Amusingly, it displayed an error message saying that replacing the current language was not permitted, but in practice it was since the new settings were applied when I hit the "apply" button, and restarted the machine.

share|improve this answer

Guys guys why are you going crazy?? All you need is to go to Search bar or Unity Lens (if Ubuntu) type "Language" you will find "Country/Region & Language" Application. In the "Country" Tab Choose your desired locale language.

If you want to keep current locale and change some other options like date format, or imperial to metric measurements, just use the other tabs! :)

This is available in Ubuntu distro 14.04 LTS and later.

share|improve this answer
    
Ubuntu has Unity by default. This is a KDE issue. Completely unrelated. Besides, changing the regional settings didn't fix the issue, as stated in op. Still thank you for taking your time to try to fix this issue. –  Calabacin Feb 6 at 14:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.