Created attachment 156001 [details]
old vs new KCM differences
Right now there doesn't seem to be a way to set the user's preference for CJK characters such as 今 and 置 that are displayed differently across Chinese, Korean and Japanese.
Before the language/format KCM merge, after much trouble, I discovered it was possible to change this using Region in the old KCM (a crude solution). See attachment, tested on Kubuntu 22.04 with Plasma 5.24.
However setting the region isn't available in the new KCM. I'm unable to find a way to switch away from Japanese character variants on Fedora, even when the system's primary language is set to Chinese.
STEPS TO REPRODUCE
1. On a recent Fedora KDE, install with English as the system language (maybe not needed)
2. It displays Japanese variants by default
3. Add Chinese to the language list in an attempt to display Chinese variants and restart session
4. It doesn't work
There seems to be no way to set this preference.
There should be a way to set unicode CJK preference in the systemsettings GUI. The way this works e.g. on Windows and Android is that if there is Chinese/Japanese in the language list (even as a secondary one below the primary UI language), the system displays that language's variants of affected characters whenever possible.
Is there something KDE can do about this and apply the appropriate setting to the system according to the language list so that this is achieved?
Operating System: Fedora Linux 37
KDE Plasma Version: 5.26.5
KDE Frameworks Version: 5.102.0
Qt Version: 5.15.8
Created attachment 156002 [details]
secondary language Chinese
Apologies, I made a mistake an in the original attachment. Fedora is actually showing the correct variants when it's the primary language.
However the point still stands in case Chinese is below English, the system shows Japanese variants in that case. There is no way in the GUI to specify Chinese variants as the preference.
Both old and new KCM only set ~/.config/plasma-localerc, check if there's difference there. And make sure you test after reboot.
Here are the contents on my English-language Kubuntu system where setting a CJK preference through Region in the old KCM works:
KDE Language list - en_GB only; Formats > Region > ja_JP or zh_CN, etc to set CJK pref.
$ cat .config/plasma-localerc
Fedora system where it doesn't work by putting Chinese below English (a reboot doesn't help):
This can be considered a feature request that entails determining how to approach this and implementing a way to do it in new KCM better and more clearly than the old KCM.
CJK preference is not supported by POSIX nor ICU, what you did in the old KCM is very hacky. By definition, LANG is used to specify the "master" language of the system, and LANGUAGE is used to configure additional fallback language when there is no translation for LANG.
LANGUAGE should include LANG that is. You've set LANG to ja_JP and LANGUAGE to en_GB. That's actually undefined behavior, application can show Japanese or British English. If you want to rely on this behavior, you can edit ~/.config/plasma-localerc yourself.
"CJK preference is not supported by POSIX nor ICU"
This is a serious issue with Linux localization and if there isn't a good way to do it in the GUI, without diving into command line and system configs, then it should be investigated to see what can be done on the KDE side.
I'm rather disappointed to see this slapped with NOTABUG when it's a feature on e.g. Android and Windows that works as expected using the language list.
Changed to UPSTREAM because there is nothing KDE can do. Please read https://www.gnu.org/savannah-checkouts/gnu/gettext/manual/gettext.html#Locale-Environment-Variables
Fonts can be configured in the font KCM and some like Noto support several variants as evidenced by the old KCM Region "hack" that works fine and doesn't result in non-English text anywhere
Isn't there something KDE can do through the font config like the following? Not sure if this is distro-specific
(In reply to wazhai from comment #7)
> Fonts can be configured in the font KCM and some like Noto support several
> variants as evidenced by the old KCM Region "hack" that works fine and
> doesn't result in non-English text anywhere
> Isn't there something KDE can do through the font config like the following?
> Not sure if this is distro-specific
I believe we can. moved to font KCM. Note that by GNU specification, LANGUAGE has higher precedence than LANG, so set en_GB in LANGUAGE will override LANG=ja_JP. Thus an undefined behavior. Set font family is the way to go
Created attachment 156028 [details]
I have finally managed to set a per-user preference for Simplified Chinese variants on Fedora through fontconfig. I copied the exact config from the above Ubuntu instructions while retaining a "proper" locale with only "LANG=en_GB" and no LANGUAGE set.
It's the file ~/.config/fontconfig/fonts.conf with content from Ubuntu's /etc/fonts/conf.avail/64-language-selector-prefer.conf where Noto CJK SC and TC were manually moved above JP (file attached here)
The goal would be for Plasma users to be able to configure a CJK preference easily somewhere in the settings GUI.
Is it even possible to implement something generic as part of the font KCM that's not necessarily tied to Noto and distro-agnostic?
It is! I was just running into this and I found the solution.
I have the opposite problem in Fedora (I want Japanese and I'm getting Chinese), and I tracked it down to having Droid Sans Fallback installed (which uses Chinese glyphs), but then the behavior is inconsistent between Qt and other fontconfig apps. If you don't have that font, it just picks a random CJK font, which completely by chance happens to be the JP one. Fontconfig itself will also do that and ignore Droid Sans Fallback due to a language mismatch (it uses different logic to Qt). So really, the default is totally inconsistent and random-ish when there is no Han language preference.
This is the solution:
<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">
<edit name="lang" mode="append"><string>ja</string></edit>
What that does is add "ja" to the list of languages being matched, after the existing list (which should be derived from the system primary language list). So that would cause the system to fall back to Japanese fonts. If the Noto Sans CJK fonts are correctly configured as fallbacks for their respective language (they are in Fedora), then that all works, and you don't need to specify specific fonts or anything like that. Of course it's up to distros to configure language-specific fallback correctly, but I think that's something they would have to do to support the normal use case of the primary language being a CJK one, so hopefully they do that properly!
I think KDE should always add all the languages configured in Regional Settings > Language to ~/.fonts.conf or similar like that (including the primary one). Then whatever language the normal mechanisms choose will still take precedence, but then after that fontconfig will try the user-configured languages in Plasma, and then the font fallback order should be correct. So it will work like in Windows/Android.
Also an unrelated note for other people who end up here: Firefox uses its own logic for this and you have to edit the `font.cjk_pref_fallback_order` pref to change the CJK fallback order. It's a bit unfortunate that that's a hidden preference...