Locales conflict

Help with the version of MX KDE officially released by the Development Team.
When asking for help, use Quick System Info from MX Tools. It will be properly formatted using the following steps.
1. Click on Quick System Info in MX Tools
2. Right click in your post and paste.
Message
Author
User avatar
n8ive999
Posts: 16
Joined: Mon Apr 11, 2022 6:57 pm

Locales conflict

#1 Post by n8ive999 »

Hi, new member here,

I am using MX-21 KDE and was looking at my regional format settings, trying to get numbers to be be displayed 1 234.56 (space as thousands separator and . as decimal character).
In settings > fomats, I have set numbers (and time) to en_GB (from en_ZA), while everything else is en_ZA.

The differences in the display is such:
en_ZA shows numbers as 1 000,00
en_GB shows numbers as 1,000.00

Yet, when I look at the locales definitions in /usr/share/i18n/locales/
LC_NUMERIC is defined exactly the same (en_GB vs en_ZA), i.e

Code: Select all

LC_NUMERIC
decimal_point           "."
thousands_sep           ","
grouping                3;3
END LC_NUMERIC
I wanted to modify my locale by following this link
https://askubuntu.com/questions/21316/h ... tem-locale,
but the instructions are for a different system which has folders that I do not.

Why is the NUMERIC value different for the same definition?
How do I change the definition to suit my needs?

I also want to apply the en_GB date format to en_ZA.


My system

Code: Select all

System:    Kernel: 5.10.0-13-amd64 x86_64 bits: 64 compiler: gcc v: 10.2.1 
           parameters: BOOT_IMAGE=/boot/vmlinuz-5.10.0-13-amd64 root=UUID=<filter> ro 
           quiet splash 
           Desktop: KDE Plasma 5.20.5 info: latte-dock wm: kwin_x11 vt: 7 dm: SDDM 
           Distro: MX-21_KDE_x64 Wildflower October 20  2021 base: Debian GNU/Linux 11 (bullseye) 
Machine:   Type: Laptop System: LENOVO product: 36807K4 v: ThinkPad X201 serial: <filter> Chassis: type: 10 
           serial: <filter> 
           Mobo: LENOVO model: 36807K4 serial: <filter> BIOS: LENOVO v: 6QET70WW (1.40 ) date: 10/11/2012 
Battery:   ID-1: BAT0 charge: 0.3 Wh (100.0%) condition: 0.3/62.2 Wh (0.5%) volts: 12.5 min: 11.1 
           model: LGC 42T4837 type: Li-ion serial: <filter> status: Full 
CPU:       Info: Dual Core model: Intel Core i7 M 620 bits: 64 type: MT MCP arch: Nehalem family: 6 
           model-id: 25 (37) stepping: 5 microcode: 7 cache: L2: 4 MiB 
           flags: lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx bogomips: 21280 
           Speed: 1451 MHz min/max: 1199/2667 MHz boost: enabled Core speeds (MHz): 1: 1451 2: 1454 3: 1477 
           4: 1416 
           Vulnerabilities: Type: itlb_multihit status: KVM: VMX disabled 
           Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT vulnerable 
           Type: mds status: Vulnerable: Clear CPU buffers attempted, no microcode; SMT vulnerable 
           Type: meltdown mitigation: PTI 
           Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl and seccomp 
           Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization 
           Type: spectre_v2 mitigation: Retpolines, IBPB: conditional, IBRS_FW, STIBP: conditional, RSB filling 
           Type: srbds status: Not affected 
           Type: tsx_async_abort status: Not affected 
Graphics:  Device-1: Intel Core Processor Integrated Graphics vendor: Lenovo driver: i915 v: kernel 
           bus-ID: 00:02.0 chip-ID: 8086:0046 class-ID: 0300 
           Device-2: Lenovo Integrated Webcam type: USB driver: uvcvideo bus-ID: 1-1.6:5 chip-ID: 17ef:4816 
           class-ID: 0e02 
           Display: x11 server: X.Org 1.20.13 compositor: kwin_x11 driver: loaded: intel display-ID: :0 
           screens: 1 
           Screen-1: 0 s-res: 2720x900 s-dpi: 96 s-size: 719x238mm (28.3x9.4") s-diag: 757mm (29.8") 
           Monitor-1: LVDS1 res: 1280x800 hz: 60 dpi: 125 size: 261x163mm (10.3x6.4") diag: 308mm (12.1") 
           Monitor-2: VGA1 res: 1440x900 hz: 60 dpi: 89 size: 410x256mm (16.1x10.1") diag: 483mm (19") 
           OpenGL: renderer: Mesa DRI Intel HD Graphics (ILK) v: 2.1 Mesa 21.2.5 direct render: Yes 
Audio:     Device-1: Intel 5 Series/3400 Series High Definition Audio vendor: Lenovo driver: snd_hda_intel 
           v: kernel bus-ID: 00:1b.0 chip-ID: 8086:3b56 class-ID: 0403 
           Sound Server-1: ALSA v: k5.10.0-13-amd64 running: yes 
           Sound Server-2: PulseAudio v: 14.2 running: yes 
Network:   Device-1: Intel 82577LM Gigabit Network vendor: Lenovo driver: e1000e v: kernel port: 1820 
           bus-ID: 00:19.0 chip-ID: 8086:10ea class-ID: 0200 
           IF: eth0 state: up speed: 1000 Mbps duplex: full mac: <filter> 
           Device-2: Intel Centrino Advanced-N 6200 driver: iwlwifi v: kernel modules: wl port: 1880 
           bus-ID: 02:00.0 chip-ID: 8086:4239 class-ID: 0280 
           IF: wlan0 state: down mac: <filter> 
Drives:    Local Storage: total: 465.76 GiB used: 192.6 GiB (41.4%) 
           SMART Message: Unable to run smartctl. Root privileges required. 
           ID-1: /dev/sda maj-min: 8:0 vendor: Hitachi model: HTS545050B9A300 size: 465.76 GiB block-size: 
           physical: 512 B logical: 512 B speed: 3.0 Gb/s type: HDD rpm: 5400 serial: <filter> rev: C61H 
           scheme: MBR 
Partition: ID-1: / raw-size: 29.3 GiB size: 28.67 GiB (97.86%) used: 13.15 GiB (45.9%) fs: ext4 dev: /dev/sda5 
           maj-min: 8:5 
           ID-2: /home raw-size: 308.85 GiB size: 303 GiB (98.11%) used: 179.46 GiB (59.2%) fs: ext4 
           dev: /dev/sda7 maj-min: 8:7 
Swap:      Kernel: swappiness: 15 (default 60) cache-pressure: 100 (default) 
           ID-1: swap-1 type: partition size: 6.84 GiB used: 0 KiB (0.0%) priority: -2 dev: /dev/sda6 
           maj-min: 8:6 
Sensors:   System Temperatures: cpu: 48.0 C mobo: 0.0 C 
           Fan Speeds (RPM): cpu: 3278 
Repos:     Packages: note: see --pkg apt: 2920 lib: 1597 flatpak: 0 
           No active apt repos in: /etc/apt/sources.list 
           No active apt repos in: /etc/apt/sources.list.d/atareao-ubuntu-telegram-jammy.list 
           Active apt repos in: /etc/apt/sources.list.d/bluemail.list 
           1: deb https://packages.bluemail.me/repos/debian/ ./
           Active apt repos in: /etc/apt/sources.list.d/debian-stable-updates.list 
           1: deb http://deb.debian.org/debian/ bullseye-updates main contrib non-free
           Active apt repos in: /etc/apt/sources.list.d/debian.list 
           1: deb http://deb.debian.org/debian/ bullseye main contrib non-free
           2: deb http://security.debian.org/debian-security/ bullseye-security main contrib non-free
           Active apt repos in: /etc/apt/sources.list.d/mx.list 
           1: deb https://ftp.saix.net/pub/linux/distributions/mxlinux/mx/repo/ bullseye main non-free
           2: deb https://ftp.saix.net/pub/linux/distributions/mxlinux/mx/repo/ bullseye ahs
           No active apt repos in: /etc/apt/sources.list.d/nilarimogard-ubuntu-webupd8-jammy.list 
           Active apt repos in: /etc/apt/sources.list.d/vivaldi-archive.list 
           1: deb [signed-by=/usr/share/keyrings/vivaldi-browser.gpg arch=amd64] https://repo.vivaldi.com/archive/deb/ stable main
           Active apt repos in: /etc/apt/sources.list.d/vivaldi.list 
           1: deb [arch=amd64] https://repo.vivaldi.com/stable/deb/ stable main
Info:      Processes: 234 Uptime: 43m wakeups: 2 Memory: 7.57 GiB used: 2.48 GiB (32.8%) Init: SysVinit v: 2.96 
           runlevel: 5 default: 5 tool: systemctl Compilers: gcc: 10.2.1 alt: 10 Shell: bash 
           default: Bash v: 5.1.4 running-in: quick-system-info-mx inxi: 3.3.06 
Boot Mode: BIOS (legacy, CSM, MBR)

User avatar
Adrian
Developer
Posts: 9146
Joined: Wed Jul 12, 2006 1:42 am

Re: Locales conflict

#2 Post by Adrian »

Where do you change that in Plasma Settings? https://userbase.kde.org/File:Settings-locale.png

User avatar
n8ive999
Posts: 16
Joined: Mon Apr 11, 2022 6:57 pm

Re: Locales conflict

#3 Post by n8ive999 »

Adrian wrote: Mon Apr 11, 2022 8:00 pm Where do you change that in Plasma Settings? https://userbase.kde.org/File:Settings-locale.png
I set it in System settings > Personalisation > Formats
locale settings.png
You do not have the required permissions to view the files attached to this post.

User avatar
fehlix
Developer
Posts: 12811
Joined: Wed Apr 11, 2018 5:09 pm

Re: Locales conflict

#4 Post by fehlix »

n8ive999 wrote: Mon Apr 11, 2022 7:47 pm I wanted to modify my locale by following this link
https://askubuntu.com/questions/21316/h ... tem-locale,
but the instructions are for a different system which has folders that I do not.

Why is the NUMERIC value different for the same definition?
How do I change the definition to suit my needs?

I also want to apply the en_GB date format to en_ZA.
I guess, you got confused about the locale defintions you found here /usr/share/i18n/locales/en_ZA
and
/usr/share/i18n/locales/en_GB
in comparision to what Kde/Plasma apps do show.

And you are right, the locale defined for en_ZA in /usr/share/i18n/locales
would show different numeric formats for those programs, which do use
the corresponding compiled locales compare to the Qt-apps, which are using Kde/Plasma defined formats.
Let's check.
First I reduced all local defined to just en_GB and en_ZA:

Code: Select all

locale -a | grep utf
en_GB.utf8
en_ZA.utf8
Now lets display the numeric format and regional date format within the console using bash printf "%'.2f" and date +%x

Code: Select all

for L in en_GB en_ZA; do LC=$L.UTF-8; FS="\\\n$L:\ %\'.2f\\\n"; CMD="LANG=$LC; printf $FS 10000; date +%x_%X"; bash -c "$CMD"; done
en_GB: 10,000.00   12/04/22_17:24:06
en_ZA: 10,000.00   12/04/2022_17:24:06
So it looks, the numeric format definde for both en_ZA and en_GB show in bash show identical.
And this is different to Kde/Plasma own set of format definition, which I guess
you are saying is the correct form.

OK, let's fix numeric format for decimal point and thousand separator,
e.g either within editor or just this way:

Code: Select all

sudo sed -i.orig  '/^decimal_point/s/\./,/; /^thousands_sep/s/,/ /' /usr/share/i18n/locales/en_ZA
which gives the desired result:

Code: Select all

grep -A4 ^LC_NUMERIC  /usr/share/i18n/locales/en_ZA
LC_NUMERIC
decimal_point           ","
thousands_sep           " "
grouping                3;3
END LC_NUMERIC
Now compile the locale definition:

Code: Select all

sudo locale-gen

Generating locales (this might take a while)...
  en_GB.UTF-8... done
  en_ZA.UTF-8... done
Generation complete.
Now check again, what we get with bash:

Code: Select all

for L in en_GB en_ZA; do LC=$L.UTF-8; FS="$L:\ %\'.2f\\\n"; CMD="LANG=$LC; printf $FS 10000; date +%x_%X"; bash -c "$CMD"; done
en_GB: 10,000.00 12/04/22_18:13:09
en_ZA: 10 000,00 12/04/2022_18:13:09
Which gives the same output as what Kde/Pasma's own format definition are showing.
Maybe I have not completely understood your questions?

User avatar
n8ive999
Posts: 16
Joined: Mon Apr 11, 2022 6:57 pm

Re: Locales conflict

#5 Post by n8ive999 »

Thanks @fehlix .

Two things

1. REGEXP
I find it hard to read REGEXP syntax, so I GUESS your code changes are :
for decimal point - change "." to ","
for thousands sep - change "," to " "
Is this correct?


2. KDE displays vs what rest of system
You are saying that the KDE display is NOT what the rest of the system eg. LibrOffice, Konsole uses/shows. In other words, what is defined in said locales definitions (en_ZA) is the actual definitive implementations, and should ignore KDE displays?

If my assumptions are correct, and what I actually want is for
en_ZA
decimal_point "."
thousands_sep " "

Then I can just make the appropriate changes and ignore what Qt displays?

User avatar
n8ive999
Posts: 16
Joined: Mon Apr 11, 2022 6:57 pm

Re: Locales conflict

#6 Post by n8ive999 »

Using my new implementation of Locales, I tried to get LO Calc to obey my newly created definitions.

And it just won't do it. (setting Dec-sep in Language to "Same as locale" triggers LO to change back to default. "Default" is apparently hard-coded) :eek:

I discovered this discussion re SA standards.
https://ask.libreoffice.org/t/decimal-s ... y/53597/7
So I guess this mentality has infiltrated all of Linux / Open-source coding.

I am at a loss.

User avatar
fehlix
Developer
Posts: 12811
Joined: Wed Apr 11, 2018 5:09 pm

Re: Locales conflict

#7 Post by fehlix »

n8ive999 wrote: Fri Apr 15, 2022 6:50 am Thanks @fehlix .

Two things

1. REGEXP
I find it hard to read REGEXP syntax, so I GUESS your code changes are :
for decimal point - change "." to ","
for thousands sep - change "," to " "
Is this correct?
That's correct, the result of the changed adjustment using sed, was shown
and here again:

Code: Select all

grep -A4 ^LC_NUMERIC  /usr/share/i18n/locales/en_ZA
LC_NUMERIC
decimal_point           ","
thousands_sep           " "
grouping                3;3
END LC_NUMERIC
which appears to be what you are looking for.
n8ive999 wrote: Fri Apr 15, 2022 6:50 am 2. KDE displays vs what rest of system
You are saying that the KDE display is NOT what the rest of the system eg. LibrOffice, Konsole uses/shows. In other words, what is defined in said locales definitions (en_ZA) is the actual definitive implementations, and should ignore KDE displays?

If my assumptions are correct, and what I actually want is for
en_ZA
decimal_point "."
thousands_sep " "

Then I can just make the appropriate changes and ignore what Qt displays?
That's the point most Kde app are certainly written within Qt, and Kde/Plasma appears to have it's own
locale system including defaults.
So depending what app you start, most apps including Qt-apps would probably still look for the systemwide compiled locale definitions. And probably Kde/Plasma specifc "apps" may use Kde/Plamas defined ones.
Locale-aware application may prefer to get the locale definition
from the compile locale-archive found within /usr/lib/locale/,
which you can list with

Code: Select all

locale -a
So best to make your en_ZA.UTF-8 adjustments as suggested, which would make show
the adjusted numeric (or date format - if adjusted ) properly.
My assumption is the Kde/plasma definitions are the "correct" one (whatever this means)
and your adjusted and compiled of the "corrected" locale definition from /usr/share/i18n/locales/en_ZA.
would make the none-Kde/Plasma specific apps display the corrected format properly.
In the ideal world the definitions here /usr/share/i18n/locales/en_ZA
should be corrected "upstream" (which means in "Debian"). It may even be
an "issue" within the locale standard definition. But I'm not a locale expert, to tell.

User avatar
n8ive999
Posts: 16
Joined: Mon Apr 11, 2022 6:57 pm

Re: Locales conflict

#8 Post by n8ive999 »

You may have missed this.
n8ive999 wrote: Fri Apr 15, 2022 8:01 am Using my new implementation of Locales, I tried to get LO Calc to obey my newly created definitions.

And it just won't do it. (setting Dec-sep in Language to "Same as locale" triggers LO to change back to default. "Default" is apparently hard-coded) :eek:

I discovered this discussion re SA standards.
https://ask.libreoffice.org/t/decimal-s ... y/53597/7
So I guess this mentality has infiltrated all of Linux / Open-source coding.

I am at a loss.

User avatar
fehlix
Developer
Posts: 12811
Joined: Wed Apr 11, 2018 5:09 pm

Re: Locales conflict

#9 Post by fehlix »

n8ive999 wrote: Fri Apr 15, 2022 8:01 am Using my new implementation of Locales, I tried to get LO Calc to obey my newly created definitions.

And it just won't do it. (setting Dec-sep in Language to "Same as locale" triggers LO to change back to default. "Default" is apparently hard-coded) :eek:

I discovered this discussion re SA standards.
https://ask.libreoffice.org/t/decimal-s ... y/53597/7
So I guess this mentality has infiltrated all of Linux / Open-source coding.

I am at a loss.
Not sure .. I got this in LO-Calc:
Set format of a Cell to en_ZA (which shows propely):
LO-Calc-Number-format-en-ZA.png
Displays as set:
LO-Calc-Number-format-en-ZA-2.png
You do not have the required permissions to view the files attached to this post.

User avatar
n8ive999
Posts: 16
Joined: Mon Apr 11, 2022 6:57 pm

Re: Locales conflict

#10 Post by n8ive999 »

Is this after your edits in Post no 3?
What are your LANGUAGE settings in LO?

Post Reply

Return to “MX KDE Official Release”