Man: can't set the locale; make sure $LC_* and $LANG are correct

Whenever I open a manual for a code by typing:
man the name of the code
it always says “man: can’t set the locale; make sure $LC_* and $LANG are correct”
What can I do about that?

It depends on your language.
Here a example for German speakers.

Do a sudo nano /etc/locale.gen and de-comment the language you want to use.
In my example de_DE.UTF-8 UTF-8

Do a locale-gen to generate locales.

Than do for e.g. German echo LANG=de_DE.UTF-8 > /etc/locale.conf

And last, do a reboot.

I wrote sudo nano /etc/locale.gen and checked, “en_GB.UTF-8 UTF-8” line is already uncommented.

there is an error like: echo LANG=en_GB.UTF-8 > /etc/locale.conf
bash: /etc/locale.conf: Permission denied
and when I type it with sudo, error continues

There is another post about this problem and

In that post it looks like they found the solution but i don’t understand what they mean by “deleting this ~/.config/plasma-localerc file”

Search is your friend

OK you prefer British English.

Sometimes there is no translation for manpages.
Than you need a fallback to american (computer) English in /etc/locale.gen file.

These should be uncommended here:
en_BR.UTF-8 UTF-8
en_DK.UTF-8 UTF-8
en_US.UTF-8 UTF-8

Than do a
sudo locale-gen
again.

Please do a
cat /etc/locale.conf
and post the output

en_US.UTF-8 is here o.K.
The locale.conf is for Gui-Aplication menues.
Take the American once. :wink:

I’m sorry to bother you all the time, but I guess I found out what caused the problem
Look what I found on the terminal:

$ locale -a
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
C
POSIX
en_US.utf8

Does it means that I should download a language pack for these or what?

That’s allright. Configuration of locales is a nasty thing at all.
I guess Mangaro does a fault with this.

Please post the output of
less /etc/locale.gen | grep -v \#

Of course.
less /etc/locale.gen | grep -v #
en_US.UTF-8 UTF-8

Just an observation, no need for the pipe: grep -v \# /etc/locale.gen

If you are using KDE, I’d stick to the KDE-way of doing things through their System Settings.
This is actually a Manjaro setting section (it’s a separate app in XFCE)

/etc/locale.gen is managed via: KDE System Settings > Locale

There are 2 language variables, plus LC variables. Take a look at your environment:
declare -p ${!LANG@} ${!LC@}

There is also, KDE System Settings > Regional Settings > Language
This seems to update the file ~/.config/plasma-localerc.
imho, deleting a file is always the last resort. Always backup before deleting.

I have a file ~/.config/plasma-locale-settings.sh that says “do not edit, generated script… generated by kcmshell5 formats”, which is the same as KDE System Settings > Regional Settings > Formats.

man man says:

This package supports manual pages in multiple languages, controlled by your locale. If your system did not set this up for you automatically, then you may needs to set $LC_MESSAGES, $LANG, or another…

You may need to logout/in to get the new environment. This seemed to take a long time. Resist hitting reset :slight_smile:

If you do a man -d man (second man can be replaced), the output will show what locales man is looking for. (For example, I added Deutsch via Settings > Regional Settings > Language and I promoted it to the default (hover over the language and icons appear on the right). The debug output showed:

checking for locale de
checking for locale en_US
checking for locale en_US.UTF.8

This updated file .config/plasma-localerc, which set

[Translations]
LANGUAGE=de:en_US

locale -a or localectl list-locales didn’t change. They only contained en_US.UTF.8 in my case.

Bottom-line
Go to Settings > Regional Settings > Language.
Set your languages. The first one is the default.
Apply.
Logoff/on (wait…).
Double check: cat ~/.config/plasma-localrc

When I change my region from mine to US it worked and there is no more error like before.
Thank you for helping me and thank you for your time for me.

De nada, avec plesire… @realbutterletto

@philm
That’s because there exists no translation from US to the Britsh for man pages :scream_cat:

Manjaro makes here the fault not to activate en_BR.UTF-8 and en_US.UTF.8 as a fallback language in locale.gen when calamares configuers lokalisation.
MY TWO CENT’S

That’s improofs my terminal knowledge, Thank you!

When I have installed Manjaro XFCE with location set to London, UK; calamares creates 2 languages en_GB.UTF-8 UTF-8 and en_US.UTF-8 UTF-8

But I usually remove en_US.UTF-8 UTF-8 in manjaro-settings-manager -m msm_locale

Never had a problem reading the fine manpages

Just my two pennyworth

If you

Never had a problem reading the fine manpages

,then I will not tell you anything.
I’m used to Arch Linux and do not know a lot about what
Manjaro tools do and what they are not doing.
I’m used to configure system manually.
So if your configuration fits your purpose than everything is alright.

P.S.:
https://wiki.archlinux.org/index.php/Locale

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.