Bug 461904 - if I apply changes and then revert them before re-login, 'Region & Language' KCM falsely reports asian language/formats after the next login
Summary: if I apply changes and then revert them before re-login, 'Region & Language' ...
Status: REOPENED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_regionandlang (other bugs)
Version First Reported In: master
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-11-16 12:26 UTC by Patrick Silva
Modified: 2024-10-16 19:46 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.2.0
Sentry Crash Report:


Attachments
screenshot1 (147.37 KB, image/png)
2022-11-16 12:26 UTC, Patrick Silva
Details
screenshot2 (103.47 KB, image/png)
2022-11-16 12:26 UTC, Patrick Silva
Details
KCM and outputs (170.52 KB, image/png)
2022-11-23 10:45 UTC, Patrick Silva
Details
translation of a newly created user account (129.10 KB, image/png)
2022-12-04 10:45 UTC, Patrick Silva
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Patrick Silva 2022-11-16 12:26:38 UTC
Created attachment 153802 [details]
screenshot1

STEPS TO REPRODUCE
1. open 'Region & Language' KCM
2. observe the current language
3. choose another language and apply the change
4. revert to the initial language observed in the step 2
5. logout and login
6. open 'Region & Language' KCM

OBSERVED RESULT
UI language is the one applied in the step 4 but the KCM reports language and formats from some asian country.
Please see the attached screenshots.

EXPECTED RESULT
the observed result should not occur

SOFTWARE/OS VERSIONS
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.26.80
KDE Frameworks Version: 5.100.0
Qt Version: 5.15.7
Graphics Platform: Wayland
Comment 1 Patrick Silva 2022-11-16 12:26:53 UTC
Created attachment 153803 [details]
screenshot2
Comment 2 Nate Graham 2022-11-16 18:14:37 UTC
Well that's weird. Two questions:

1. In "4. revert to the initial language observed in the step 2", how do you revert it? By clicking the Defaults button, or actually by manually changing it back to the original language?
2. After step 4, what is the contents of ~/.config/plasma-localerc?
Comment 3 Patrick Silva 2022-11-16 19:01:07 UTC
(In reply to Nate Graham from comment #2)
> Well that's weird. Two questions:
> 1. In "4. revert to the initial language observed in the step 2", how do you revert it?
I click on 'Modify...' button, choose the original language and click on 'Apply' button.

> 2. After step 4, what is the contents of ~/.config/plasma-localerc?
$ cat ~/.config/plasma-localerc
[Formats]
LANG=ko_KR.UTF-8

[Translations]
LANGUAGE=en_US
Comment 4 Nate Graham 2022-11-16 19:03:50 UTC
Well that makes no sense. I assume you never manually set Korean as the system language?

Can you paste the contents of that file after every step in your steps to reproduce?
Comment 5 Patrick Silva 2022-11-16 21:21:11 UTC
Contents after the steps 1 and 2:
[Formats]
LANG=en_US.UTF-8

[Translations]
LANGUAGE=en_US

Contents after the step 3:
[Formats]
LANG=pt_BR.UTF-8

[Translations]
LANGUAGE=pt_BR

Contents after the step 4:
[Translations]
LANGUAGE=en_US

Contents after the steps 5 and 6:
[Formats]
LANG=ko_KR.UTF-8

[Translations]
LANGUAGE=en_US
Comment 6 hanyoung 2022-11-17 13:09:02 UTC
The default for Language is `$LANG`. It could be that you have "ko_KR.UTF-8" in your environment.
Comment 7 Nate Graham 2022-11-18 17:11:45 UTC
Indeed. Patrick, can you paste the output of:

1. `env | grep -i lang`
2. `cat /etc/locale.conf`
Comment 8 Patrick Silva 2022-11-19 09:35:07 UTC
$ env | grep -i lang
LANGUAGE=en_US
LANG=ko_KR.UTF-8

$ cat /etc/locale.conf
LANG=pt_BR.UTF-8
LC_ADDRESS=pt_BR.UTF-8
LC_IDENTIFICATION=pt_BR.UTF-8
LC_MEASUREMENT=pt_BR.UTF-8
LC_MONETARY=pt_BR.UTF-8
LC_NAME=pt_BR.UTF-8
LC_NUMERIC=pt_BR.UTF-8
LC_PAPER=pt_BR.UTF-8
LC_TELEPHONE=pt_BR.UTF-8
LC_TIME=pt_BR.UTF-8
Comment 9 Nate Graham 2022-11-21 21:07:45 UTC
And those are the values *before* you perform the steps to reproduce?
Comment 10 Patrick Silva 2022-11-21 21:37:31 UTC
before the steps:

$ env | grep -i lang
LANGUAGE=en_US
LANG=en_US.UTF-8

$ cat /etc/locale.conf
LANG=pt_BR.UTF-8
LC_ADDRESS=pt_BR.UTF-8
LC_IDENTIFICATION=pt_BR.UTF-8
LC_MEASUREMENT=pt_BR.UTF-8
LC_MONETARY=pt_BR.UTF-8
LC_NAME=pt_BR.UTF-8
LC_NUMERIC=pt_BR.UTF-8
LC_PAPER=pt_BR.UTF-8
LC_TELEPHONE=pt_BR.UTF-8
LC_TIME=pt_BR.UTF-8
Comment 11 Nate Graham 2022-11-22 18:47:33 UTC
This is very confusing.
Comment 12 Patrick Silva 2022-11-23 10:45:01 UTC
Created attachment 153973 [details]
KCM and outputs

I have just noticed that the KCM does not apply the formats settings correctly. Now I have both language and formats set to
American English, but Dolphin reports file sizes like 5,5 MiB (portuguese - Brazil) instead of 5.5 Mib (american english).
And I get these outputs:

$ env | grep -i lang
LANGUAGE=en_US
LANG=en_US.UTF-8

$ cat /etc/locale.conf
LANG=pt_BR.UTF-8
LC_ADDRESS=pt_BR.UTF-8
LC_IDENTIFICATION=pt_BR.UTF-8
LC_MEASUREMENT=pt_BR.UTF-8
LC_MONETARY=pt_BR.UTF-8
LC_NAME=pt_BR.UTF-8
LC_NUMERIC=pt_BR.UTF-8
LC_PAPER=pt_BR.UTF-8
LC_TELEPHONE=pt_BR.UTF-8
LC_TIME=pt_BR.UTF-8

Please see the attached screenshot.
Comment 13 Patrick Silva 2022-12-04 10:45:27 UTC
Created attachment 154301 [details]
translation of a newly created user account

possibly related: as we can see in the screenshot attached to this comment, UI language is partially korean and partially english on a newly created user account.

Operating System: KDE neon Unstable Edition
KDE Plasma Version: 5.26.80
KDE Frameworks Version: 5.101.0
Qt Version: 5.15.7
Graphics Platform: Wayland
Comment 14 Nate Graham 2022-12-05 18:32:47 UTC
What's in `~/.config/plasma-localerc` for the new user account before opening the KCM?
Comment 15 Patrick Silva 2022-12-05 19:26:07 UTC
(In reply to Nate Graham from comment #14)
> What's in `~/.config/plasma-localerc` for the new user account before
> opening the KCM?

$ cat ~/.config/plasma-localerc
[Formats]
LANG=ko_KR.UTF-8
Comment 16 Nate Graham 2022-12-06 16:23:36 UTC
So you create a new user account, log in, immediately run `cat ~/.config/plasma-localerc`, and it tells you that LANG has been automatically set to Korean?
Comment 17 Patrick Silva 2022-12-06 19:59:05 UTC
(In reply to Nate Graham from comment #16)
> So you create a new user account, log in, immediately run `cat
> ~/.config/plasma-localerc`, and it tells you that LANG has been
> automatically set to Korean?

Exactly.
Comment 18 Nate Graham 2022-12-07 19:20:20 UTC
Something seems broken on your system underneath any KDE software if that's the case, but I don't know what it is.
Comment 19 Patrick Silva 2022-12-07 19:28:26 UTC
Could this bug be related to bug 409313 ?
My neon unstable 22.04 is not a fresh install, it's neon unstable based on ubuntu 20.04 upgraded to the new base.
Comment 20 Nate Graham 2022-12-07 19:34:10 UTC
It's possible.
Comment 21 Nate Graham 2023-02-14 17:38:02 UTC
I was able to reproduce this with 100% reliability:

Starting language: American English. ~/.config/plasma-localerc says:
[Formats]
LANG=en_US.UTF-8

[Translations]
LANGUAGE=en_US


Step 1: change language to Catalan and click Apply. ~/.config/plasma-localerc says:
[Formats]
LANG=ca_AD.UTF-8

[Translations]
LANGUAGE=ca


Step 2: change language to American English and click Apply. ~/.config/plasma-localerc says:
[Formats]
LANG=en_DK.UTF-8

[Translations]
LANGUAGE=en_US


Where did en_DK come from? /etc/locale.conf looks sane:

LANG="en_US.UTF-8"
Comment 22 Bug Janitor Service 2024-09-18 09:38:15 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/4717
Comment 23 Akseli Lahtinen 2024-09-19 10:47:07 UTC
Git commit 5e2c176a6e386339ce17eb4fff9a137f34e1d323 by Akseli Lahtinen.
Committed on 19/09/2024 at 10:47.
Pushed by akselmo into branch 'master'.

kcmregionandlang.cpp: Clear baseLocaleMap strings from ".UTF-8" and similar text

When constructing the baseLocaleMap, we also have the
.UTF-8 after the glibcLocale in the map.
Later in "fullMatch" iterator this breaks the matching,
since we're comparing for example "en_GB" to "en_GB.UTF-8".

They're both the same thing, but since the strings do not match,
we do not get the exact values and end up doing a lot of extra
work to match the locale to closest possible one with heuristics,
even though we have exact match already.

Removing the .UTF-8 and other similar parts from the prefixedLocales
list fixes the issue and allows full matching.
FIXED-IN: 6.2.0

M  +4    -2    kcms/region_language/kcmregionandlang.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/5e2c176a6e386339ce17eb4fff9a137f34e1d323
Comment 24 Akseli Lahtinen 2024-09-19 14:21:10 UTC
Git commit a247fd424e000b3be95298be4cd25bcb6ef9d8b6 by Akseli Lahtinen.
Committed on 19/09/2024 at 13:53.
Pushed by akselmo into branch 'Plasma/6.2'.

kcmregionandlang.cpp: Clear baseLocaleMap strings from ".UTF-8" and similar text

When constructing the baseLocaleMap, we also have the
.UTF-8 after the glibcLocale in the map.
Later in "fullMatch" iterator this breaks the matching,
since we're comparing for example "en_GB" to "en_GB.UTF-8".

They're both the same thing, but since the strings do not match,
we do not get the exact values and end up doing a lot of extra
work to match the locale to closest possible one with heuristics,
even though we have exact match already.

Removing the .UTF-8 and other similar parts from the prefixedLocales
list fixes the issue and allows full matching.
FIXED-IN: 6.2.0


(cherry picked from commit 5e2c176a6e386339ce17eb4fff9a137f34e1d323)

9abdfe55 kcmregionandlang.cpp: Clear baseLocaleMap items from UTF-8 and similar items

Co-authored-by: Akseli Lahtinen <akselmo@akselmo.dev>

M  +4    -2    kcms/region_language/kcmregionandlang.cpp

https://invent.kde.org/plasma/plasma-workspace/-/commit/a247fd424e000b3be95298be4cd25bcb6ef9d8b6
Comment 25 Patrick Silva 2024-10-15 11:48:05 UTC
The bug persists on neon unstable.

1. create a new user account in Users KCM
2. log out
3. log in with the new user account
4. open System Settings

Result: System Settings language is half english, half korean
Comment 26 Patrick Silva 2024-10-15 11:48:24 UTC
Operating System: KDE neon Unstable Edition
KDE Plasma Version: 6.2.80
KDE Frameworks Version: 6.7.0
Qt Version: 6.7.2
Graphics Platform: Wayland