Skip to content

kcms/translations: Fix mixed-up text with complex language sets

This KCM writes out a config file value that specifies a colon-separated list of languages, which startplasma.cpp uses to populate the $LANGUAGE environment variable. the language codes in this list are standard, so if you want American English first, for example, the first item in the list will be "en_US".

Unfortunately, many programs that read $LANGUAGE expect to receive the the language code "C" for their English text and do not consider en_US or en_GB (or any other en_ language) to be a localization. As a result, when $LANGUAGE is set to a string like "en_US:en_GB:fr:de" then such a program will first look for en_US, find nothing (because it is expecting C for its English text), move onto en_GB, find nothing, move onto French, display any french-localized strings, then fall back to German for any strings with no French text, and then finally fall back to American English for any remaining untranslated strings due to the global fallback to "C". This produces the characteristic effect of programs displaying a mixed-up set of text in multiple languages and almost no text in English despite an English language being set first in the KCM.

To fix it, the Language KCM now appends "C" right after the last-specified English language in the KCM, ensuring that it is used for English text after a program fails to find a specified en_* language but before it falls back to a potential other language. This preserves the user's preference to see English before other languages when they have configured this as such.

BUG: 192019 FIXED-IN: 5.23

To test this, go to the Language KCM and set your language preference to have American English as the first (preferred) language and then German second. Restart the machine and then use your distro's package manager on the command line.

Without this MR, text will be displayed in German despite American English being specified as the preferred language.

With this MR, text will be displayed in American English.

Edited by Nate Graham

Merge request reports