We are working completely in the shell (bash).
The first thing everyone should do is
sudo dpkg-reconfigure locales
The output may be the errors mentioned above and a list of locales that the script generates.
Note that the locales generated there are the only ones valid for your system.
As you can see the language settings are just a bunch of environment variables.
You can, just for fun, try a different language bash like this:
LANG=es_NI.UTF-8 bash
ls somedirectorynamethatdoesnotexistonyoursystem
Tu hablas espaniol? :-)
(if the es_NI.UTF-8 was not in your list of locales just choose another)
Ok. Obviously the LANG environment variable helps with the rest of the settings, because,
in our spanish bash we can now do
dpkg-reconfigure locales
or whatever command whose error messages led you here, and there should be no errors.
If there are, then there's something more sinister wrong that will not be covered by this post.
So, where do we set this variable LANG?
A quick search through the /etc/
directory (with rgrep LANG /etc/*
) leads us
to the file /etc/default/locale
.
There you can set the value of the variable to something different/correct.
For example
LANG=en_US.UTF-8
(That one should always work)
To finish this:
The variables mentioned in the error messages, all "derive" from LANG, meaning that they default to whatever LANG is set to, but you can set them to your liking if you want your shell to speak a different language. The package language-env helps with this.
sudo apt-get install language-env
set-language-env
The script is meant to automatically create entries for your .bashrc etc.
I haven't tried it myself.
I hope this helps someone.
Btw:
- you can find the generated locales under
ls usr/share/locale