Terminal suddenly has a wrong language

Hi!

While I have English as my default language, the Konsole has choosen to use some funny sounding language. I can see that there is a ‘de’ appended to ‘LANGUAGE’, but I have no idea where that comes from and why it is even used, since my language is English?

I am confused.

image

For a more complete setting of the localization, run the command locale. It defines some variables which could override the LANG setting.

Did you set LANGUAGE in ~/.bashrc or ~/.bash_profile maybe?

locale gives me:

office@OFFICE:~$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

~/.bashrc and ~/.bash_profile look normal to me:

office@OFFICE:~$ cat ~/.bashrc
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]; then
    PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
if [ -d ~/.bashrc.d ]; then
    for rc in ~/.bashrc.d/*; do
        if [ -f "$rc" ]; then
            . "$rc"
        fi
    done
fi
unset rc
office@OFFICE:~$ cat ~/.bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs

Please post text as pre-formatted text not screen shots using the </> button.
Then we can quote from your post and its searchable.

It seems I need to file a bug. I still have no idea why it can be German if the language is set to English.

Before that, please create a new user and check if the env variable still is in de.

Can you also add the information of your DE, Konsole seams to be KDE but it is better if you add this information while edit your topic and then add more tags. Then it gets easier to help you.

Unfortunately it turns out to be a bug which is unfixable:

What that bug is saying is that LANGUAGE=en_US:en_US:en_US:de will produce unexpected results. That explains why the setting you have leads to German error messages in Konsole.

However, going a step back to the previous “why” question: do you know why your LANGUAGE env var has the value it does? The fact that it gets that unexpected value seems to be an issue in itself, independent of the bug you linked to.

(The above question was based on my misunderstanding of the context, clarified in later posts.)

It seems that the “en” or “en_US” isn’t recognized in the LANGUAGE variable.

Example:

$ LANGUAGE=en:de ls zzz
ls: Zugriff auf 'zzz' nicht möglich: Datei oder Verzeichnis nicht gefunden

Try with French

$ LANGUAGE=fr:de ls zzz
ls: impossible d'accéder à 'zzz': Aucun fichier ou dossier de ce nom

Basically, the en_US language is the same as the native “C” language, so

$ LANGUAGE=C:fr:de ls zzz
ls: cannot access 'zzz': No such file or directory

Gives the English text.

To find out where “LANGUAGE” is set you could try to search for it with this command"

grep -Frw LANGUAGE /etc $HOME

You may not want to have it set at all and let the language be defined by LC_LANG instead.

1 Like

The root cause is that many (if not the most) programs don’t explicitly use en_US for their default language, but C. I don’t understand why this is a problem, but it seems a huge issue known for many years. KDE therefore shows following warning in the Region & Language settings:

Putting any other languages below English will cause undesired behavior in some applications. If you would like to use your system in English, remove all other languages.

A KDE developer said:

The problem seems to be that many GTK apps don’t explicitly name or alias their English locale as “en” or “en_US”, but instead make it the default locale, which is “C”. For these apps if you have “LANGUAGE=en_US” it will try to find the en_US locale, fail, and fallback to the default locale, C, which just usually happens to be English, so it seems to work. But if you have “LANGUAGE=en_US:zh_CN” it tries to find en_US, fails, moves onto zh_CN, finds it, and so displays Chinese. This can be verified by using “LANGUAGE=C:zh_CN”, which for most GTK apps should cause them to display English. Or at least mostly English: for Evolution it causes some fields/labels to be in Chinese.

The ArchWiki is also aware of it. They say:

Note: Many applications do not name or alias their English locale as en or en_US, but instead make it the default locale, which is C. If in LANGUAGE a non-English locale is placed after English, e.g. LANGUAGE=en_US:en:es_ES, then applications may choose the secondary locale despite English strings being available.[3] The solution is to always explicitly place the C locale after English. E.g. LANGUAGE=en_US:en:C:es_ES.

And so far, this seems to be the solution. I just added C right after English:

To verify it (the C right after english languages):

env | grep LANG
LANGUAGE=en_US:en_US:en_US:C:de
LANG=en_US.UTF-8

(I don’t know though why en_US is there three times now)

What shows localectl ?

System Locale: LANG=en_US.UTF-8

Please do me a favor and check with a new created user if you have the same issue as with your user.

Ah, from the screenshot, I guess that you had intentionally added German as an additional language?

I had assumed otherwise based on “some funny sounding language” in the OP :grinning_face:

You mean the initial issue? Because this will definitely be present also with a new user, since it is a confirmed bug/unintended behaviour.

Haha yes :grinning_face: But only to suppress an error message from a Windows application I started using Wine. I never use anything other than English. So I was at the first place confused why it would speak German to me.

1 Like

I am not so sure, as you can overwrite it with the user session:

Overriding system locale per user session

The system-wide locale can be overridden in each user session by creating or editing $XDG_CONFIG_HOME/locale.conf

(Source the link from Arch Wiki)

p.s.
Anyway seams to be restricted to KDE right?

I do not remember what was the case in GNOME which I used before. I reported it to KDE to bring more attention to this, maybe I can install GNOME later on a virtual machine to find out what happens there if one (only) adds an additional language.

Thanks so far for all of your help!