How to change/fix system's locale when you setup in a language not official in your country?

Solution 1:

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

Solution 2:

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.

Solution 3:

Another solution is to alias English (Spain) to English (US):

echo en_ES.UTF-8 en_US.UTF-8 >> /etc/locale.aliases

Solution 4:

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.

Solution 5:

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.