9

On my system I am getting errors(?) like this:

bash: warning: setlocale: LC_CTYPE: cannot change locale (en_DE.UTF-8)

or

weemonger@awesomeLinuxSystem:~$ dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
        LANGUAGE = "en:de:en",
        LC_ALL = (unset),
        LC_PAPER = "en_DE.UTF-8",
        LC_ADDRESS = "en_DE.UTF-8",
        LC_MONETARY = "en_DE.UTF-8",
        LC_NUMERIC = "en_DE.UTF-8",
        LC_TELEPHONE = "en_DE.UTF-8",
        LC_IDENTIFICATION = "en_DE.UTF-8",
        LC_MEASUREMENT = "en_DE.UTF-8",
        LC_TIME = "en_DE.UTF-8",
        LC_NAME = "en_DE.UTF-8",
        LANG = "en_DE.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").

How do I fix my system an get rid of the locale warnings/errors?

I have to say, that I living in Germany and use the english (en) language for my system, but also I have configured my system to use the german (DE) formats/norms for Numbers, Money, Measurements, Page size, etc.
I did this using the KDE Control Module Country/Region & Language.


I think I got rid of the warnings by myself, so I will post an answer myself, but wait some time before I accept it, as I didn't fully grok/understand it.

Byte Commander
  • 107,489
weemonger
  • 403

1 Answers1

16

Ok, here is what I assume:

I set up KDE to use the english (en) language but german (DE) formats, therefore it tries to set my locale to a combination of both: en_DE.
Like any british user would get en_UK and someone from New Zealand en_NZ.
But unfortunately noone(?) ever(?) created a locale definition for my combination: en_DE.

So all the warnings are correct and simple say, that there isn't a locale en_DE on my system and it can't be found anywhere.
After getting this insight by some googling, I made sure all necessary(?) locales are installed on my system:

sudo locale-gen en_US en_US.UTF-8 de_DE de_DE.UTF-8 

And defined that, en_DE.UTF-8 should use the same locale definition as de_DE:

sudo localedef -i de_DE -f UTF-8 en_DE.UTF-8

A subsequent sudo dpkg-reconfigure locales did no longer produce any warnings/errors and I hope, that I have fixed this annoyance.

As I mentioned in my question, I don't understand/grok the problem fully and didn't read any man pages or other official resources about locales (shame on me and I should go rtfm), so I don't know, if I really fixed my problem and didn't introduce some new by this questionable localedef call.

Hopefully someone will enlighten me and/or point the corresponding fine manual.
At least I hope, this answer help some others, who have also this strange locale en_DE and googling didn't help within the first results.

Byte Commander
  • 107,489
weemonger
  • 403
  • 2
    Strange. I think this could be a bug of KDE, because I also use English language with German formats on Unity Desktop, and I have no problems here. It did not create such an invalid locale like en_DE here. You should consider writing a bug report against KDE. See how-do-i-report-a-bug – Byte Commander Dec 18 '15 at 16:57
  • @ByteCommander: After I wrote the question, I saw a similar question in the Related question box, there it is said this is a reported bug.
    If you could mark this question as a duplicate of the other one, I would be glad.
    Maybe I should ask/read more about my localedef solution, and decide if this a possible workaround.
    – weemonger Dec 18 '15 at 17:09
  • 1
    Ok, voted to close. But you could have clicked the close link below your question yourself as well. – Byte Commander Dec 18 '15 at 17:22
  • Thank you, sorry I didn't know about the close feature - I was looking for "mark as duplicated" and didn't want to delete the question. The more you know ;) – weemonger Dec 18 '15 at 22:32