Unable to override locale re. decimal separator

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
Ventania
Level 1
Level 1
Posts: 6
Joined: Sat Nov 27, 2021 7:56 pm

Unable to override locale re. decimal separator

Post by Ventania »

Trying to use a custom mix of locale elements. Have found numerous posts about this topic on the forum, but most are a couple of years old and none of these have lead me to a solution.

What I would like is the following:
- system language: US english
- date format: dd-MMM-yy (e.g. 01-Jan-21), not sure if I could separately define a default long date format that includes the weekday
- time format: 24 hour
- numeric: decimal point, thousands separator comma (so US english format)
- monetary: currency symbol euro instead of dollar
- all of this while being Dutch and living in the Netherlands.

So far I have been unable to get the system to use decimal point instead of comma. This applies to calculator and spreadsheet software (in my case SoftMaker Office 2021).

Having read those other posts on the topic I would also like to understand how definitions in /etc/default/locale , .locale , .profile and .pam_environment relate. Which one takes priority over the other?

System info:

Code: Select all

inxi -Sxxx
System:    Host: xxxxxxxx Kernel: 5.10.0-1051-oem x86_64 bits: 64 compiler: N/A Desktop: Cinnamon 5.0.7 wm: muffin 5.0.2 
           dm: LightDM 1.30.0 Distro: Linux Mint 20.2 Uma base: Ubuntu 20.04 focal 
These are my current settings:

Code: Select all

cat /etc/default/locale
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_NUMERIC=en_US.UTF-8
LC_TIME=nl_NL.UTF-8
LC_MONETARY=nl_NL.UTF-8
LC_PAPER=nl_NL.UTF-8
LC_IDENTIFICATION=nl_NL.UTF-8
LC_NAME=nl_NL.UTF-8
LC_ADDRESS=nl_NL.UTF-8
LC_TELEPHONE=nl_NL.UTF-8
LC_MEASUREMENT=nl_NL.UTF-8

Code: Select all

cat .pam_environment
LC_NUMERIC=en_US.UTF-8
LC_TIME=nl_NL.UTF-8
LC_MONETARY=nl_NL.UTF-8
LC_PAPER=nl_NL.UTF-8
LC_IDENTIFICATION=nl_NL.UTF-8
LC_NAME=nl_NL.UTF-8
LC_ADDRESS=nl_NL.UTF-8
LC_TELEPHONE=nl_NL.UTF-8
LC_MEASUREMENT=nl_NL.UTF-8
PAPERSIZE=a4
LANGUAGE=en_US
LANG=en_US.UTF-8

Code: Select all

locale
LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=nl_NL.UTF-8
LC_TIME=nl_NL.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=nl_NL.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=nl_NL.UTF-8
LC_NAME=nl_NL.UTF-8
LC_ADDRESS=nl_NL.UTF-8
LC_TELEPHONE=nl_NL.UTF-8
LC_MEASUREMENT=nl_NL.UTF-8
LC_IDENTIFICATION=nl_NL.UTF-8
LC_ALL=

Code: Select all

localectl status
   System Locale: LANG=en_US.UTF-8
                  LANGUAGE=en_US:en
                  LC_TIME=nl_NL.UTF-8
                  LC_MONETARY=nl_NL.UTF-8
                  LC_PAPER=nl_NL.UTF-8
                  LC_NAME=nl_NL.UTF-8
                  LC_ADDRESS=nl_NL.UTF-8
                  LC_TELEPHONE=nl_NL.UTF-8
                  LC_MEASUREMENT=nl_NL.UTF-8
                  LC_IDENTIFICATION=nl_NL.UTF-8
       VC Keymap: n/a
      X11 Layout: us
       X11 Model: pc105
     X11 Variant: intl
I did add this line to .profile

Code: Select all

LC_NUMERIC="en_US.UTF-8"
but that does not seem to have any effect as shown in locale status output above.

What a I doing wrong? Any help would be greatly appreaciated. Thanks.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
mikeflan
Level 17
Level 17
Posts: 7136
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

Re: Unable to override locale re. decimal separator

Post by mikeflan »

I say you just need to get rid of that nl_NL stuff, but I don't know how you do that.
Here is mine:

Code: Select all

$ cat /etc/default/locale
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_NUMERIC=en_US.UTF-8
LC_TIME=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
LC_PAPER=en_US.UTF-8
LC_IDENTIFICATION=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

$ cat .pam_environment
cat: .pam_environment: No such file or directory

$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US:en
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=
Ventania
Level 1
Level 1
Posts: 6
Joined: Sat Nov 27, 2021 7:56 pm

Re: Unable to override locale re. decimal separator

Post by Ventania »

Thanks for your reply, but the nl_NL stuff is also correct for phone numbers and addresses and such. European formats are different from American.

It is probably better to close this thread as I have posted a similar one yesterday with a more focussed and accurate description of the issue (I think):
viewtopic.php?f=47&t=362349&p=2102258#p2102258

I have narrowed it down to .pam_environment apparently being ignored by mintlocale in my setup. Do not want to label this thread as SOLVED though, since the issue still remains.
elixxx
Level 2
Level 2
Posts: 90
Joined: Sat Oct 19, 2013 1:19 pm

Re: Unable to override locale re. decimal separator

Post by elixxx »

hi, I am also dealing with a similar problem. In my country also, locale standard requires use of a comma as decimal separator, while dot is widely used in practical life.

locale command shows actual system settings, which are nl_NL in your case for LC_NUMERIC and LC_MONETARY categories.

Code: Select all

locale -k LC_NUMERIC
and

Code: Select all

locale -k LC_MONETARY
shows values of respective parameters used.

in order to change decimal separator for numbers and currencies you could try to edit relevant definitions in /usr/share/i18n/locales/nl_NL file
and re-generate locale files afterwards with

Code: Select all

sudo locale-gen
command.
I was able to change decimal separator for my system this way. Unfortunately, success was not complete, because LibreOffice Calc app ignored new settings. Reason yet have to be clarified. Probably LO uses its own locales definitions.
Ventania
Level 1
Level 1
Posts: 6
Joined: Sat Nov 27, 2021 7:56 pm

Re: Unable to override locale re. decimal separator

Post by Ventania »

Interesting suggestion to change the actual locale definitions in /usr/share/i18n/locales/nl_NL, I had not thought of that path before. Looks a bit drastic, but may be the only way to go.

You mention LibreOffice and I had indeed also noted that that takes the locale values from another source then SoftMaker Office does. SoftMaker Office is aligned with Linux Mint Cinnamon and both ignore the settings in .pam_environment, while LibreOffice does follow the definitions in .pam_environment. This lack of consistency is somewhat frustrating, especially since most "regular" solutions point to changing .pam_environment, which has not worked for me.

It is already late at my location. Will try your suggested solution tomorrow and report back here. Thanks for the tip!
User avatar
absque fenestris
Level 12
Level 12
Posts: 4110
Joined: Sat Nov 12, 2016 8:42 pm
Location: Confoederatio Helvetica

Re: Unable to override locale re. decimal separator

Post by absque fenestris »

I don't think that Dutch settings are more complicated than mine for Swiss High German.
These are the settings in the System Settings "Language" and supplementary settings for LibreOffice - in your case just choose the appropriate Dutch settings:

Image

Image

Image

Code: Select all

m@m:~$ cat /etc/default/locale
LANG=en_US.UTF-8
LANGUAGE=en_US:en
LC_NUMERIC=de_CH.UTF-8
LC_TIME=de_CH.UTF-8
LC_MONETARY=de_CH.UTF-8
LC_PAPER=de_CH.UTF-8
LC_IDENTIFICATION=de_CH.UTF-8
LC_NAME=de_CH.UTF-8
LC_ADDRESS=de_CH.UTF-8
LC_TELEPHONE=de_CH.UTF-8
LC_MEASUREMENT=de_CH.UTF-8
Ventania
Level 1
Level 1
Posts: 6
Joined: Sat Nov 27, 2021 7:56 pm

Re: Unable to override locale re. decimal separator

Post by Ventania »

Correct, Dutch settings are not dissimilar from Swiss settings and it is good to see that this can be fine tuned from within LibreOffice. Unfortunately it does not work like that with SoftMaker Office as that just follows the same locale settings as generic Linux Mint applications. As explained in previous posts above these do not respect the settings in .pam_environment but instead take them from another (unidentified) location with apparently a higher priority.

LIbreOffice is a very complete and mature office suite, but it does not render MS Office documents on Linux as well as SoftMaker Office does. Exchanging documents with MS Office users makes me prefer SoftMaker Office over LibreOffice.
Locked

Return to “Software & Applications”