[oS-EN] Strange locale behaviour.
Hi, I have modified .bashrc thus: if [ $XDG_CURRENT_DESKTOP = KDE ]; then . ~/.i18n echo "changing the locale to .i18n" fi That part works. At least it runs. The .i18n file is: # Add user specific LANG and LC_* variables here # LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES # LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT # LC_IDENTIFICATION LC_ALL # # export LANG=en_US.UTF-8 LC_TIME="en_DK.UTF-8" LC_MONETARY="es_ES@euro" LC_TELEPHONE="es_ES@euro" LC_MEASUREMENT="es_ES@euro" LC_MONETARY="es_ES.Utf8" LC_TELEPHONE="es_ES.utf8" LC_MEASUREMENT="es_ES.utf8" LC_NAME="es_ES.utf8" LC_ADDRESS="es_ES.utf8" LC_ALL=en_US.UTF-8 cer@Laicolasse:~> When I open a new tab in konsole, or open a new xterm, I notice that the vars are exported: changing the locale to .i18n cer@Laicolasse:~> locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC=es_ES.UTF-8 LC_TIME=en_DK.UTF-8 LC_COLLATE="en_US.UTF-8" LC_MONETARY=es_ES.Utf8 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=es_ES.utf8 LC_MEASUREMENT=es_ES.utf8 LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= cer@Laicolasse:~> But not all of them. Notice that in LC_MONETARY I did a tiny modification (es_ES.Utf8) writing "utf" as "Utf". I did that silly change to see if the var was exported. Now notice "LC_NAME". In the .i18n file, it is "es_ES.utf8", but in the output of locale it is getting "en_US.UTF-8". Why, what is going on? maybe KDE overwriting it _after_ .bashrc runs? Is that var immutable? -- Cheers / Saludos, Carlos E. R. (from openSUSE 15.5 (Laicolasse))
On Wed, Nov 1, 2023 at 5:11 PM Carlos E. R. <robin.listas@telefonica.net> wrote:
Hi,
I have modified .bashrc thus:
if [ $XDG_CURRENT_DESKTOP = KDE ]; then . ~/.i18n echo "changing the locale to .i18n" fi
That part works. At least it runs.
The .i18n file is:
# Add user specific LANG and LC_* variables here # LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES # LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT # LC_IDENTIFICATION LC_ALL # # export LANG=en_US.UTF-8
LC_TIME="en_DK.UTF-8"
LC_MONETARY="es_ES@euro" LC_TELEPHONE="es_ES@euro" LC_MEASUREMENT="es_ES@euro"
LC_MONETARY="es_ES.Utf8" LC_TELEPHONE="es_ES.utf8" LC_MEASUREMENT="es_ES.utf8" LC_NAME="es_ES.utf8" LC_ADDRESS="es_ES.utf8"
LC_ALL=en_US.UTF-8 cer@Laicolasse:~>
When I open a new tab in konsole, or open a new xterm, I notice that the vars are exported:
changing the locale to .i18n cer@Laicolasse:~> locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC=es_ES.UTF-8 LC_TIME=en_DK.UTF-8 LC_COLLATE="en_US.UTF-8" LC_MONETARY=es_ES.Utf8 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=es_ES.utf8 LC_MEASUREMENT=es_ES.utf8 LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= cer@Laicolasse:~>
But not all of them.
Notice that in LC_MONETARY I did a tiny modification (es_ES.Utf8) writing "utf" as "Utf". I did that silly change to see if the var was exported. Now notice "LC_NAME". In the .i18n file, it is "es_ES.utf8", but in the output of locale it is getting "en_US.UTF-8".
Why, what is going on?
You need to export them. Show env | grep -E 'LANG|LC_'
maybe KDE overwriting it _after_ .bashrc runs? Is that var immutable?
-- Cheers / Saludos,
Carlos E. R.
(from openSUSE 15.5 (Laicolasse))
On 2023-11-01 15:16, Andrei Borzenkov wrote:
On Wed, Nov 1, 2023 at 5:11 PM Carlos E. R. <robin.listas@telefonica.net> wrote:
Hi,
I have modified .bashrc thus:
if [ $XDG_CURRENT_DESKTOP = KDE ]; then . ~/.i18n echo "changing the locale to .i18n" fi
That part works. At least it runs.
The .i18n file is:
# Add user specific LANG and LC_* variables here # LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES # LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT # LC_IDENTIFICATION LC_ALL # # export LANG=en_US.UTF-8
LC_TIME="en_DK.UTF-8"
LC_MONETARY="es_ES@euro" LC_TELEPHONE="es_ES@euro" LC_MEASUREMENT="es_ES@euro"
LC_MONETARY="es_ES.Utf8" LC_TELEPHONE="es_ES.utf8" LC_MEASUREMENT="es_ES.utf8" LC_NAME="es_ES.utf8" LC_ADDRESS="es_ES.utf8"
LC_ALL=en_US.UTF-8 cer@Laicolasse:~>
When I open a new tab in konsole, or open a new xterm, I notice that the vars are exported:
changing the locale to .i18n cer@Laicolasse:~> locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC=es_ES.UTF-8 LC_TIME=en_DK.UTF-8 LC_COLLATE="en_US.UTF-8" LC_MONETARY=es_ES.Utf8 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=es_ES.utf8 LC_MEASUREMENT=es_ES.utf8 LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= cer@Laicolasse:~>
But not all of them.
Notice that in LC_MONETARY I did a tiny modification (es_ES.Utf8) writing "utf" as "Utf". I did that silly change to see if the var was exported. Now notice "LC_NAME". In the .i18n file, it is "es_ES.utf8", but in the output of locale it is getting "en_US.UTF-8".
Why, what is going on?
You need to export them. Show
env | grep -E 'LANG|LC_'
cer@Laicolasse:~> env | grep -E 'LANG|LC_' LC_MEASUREMENT=es_ES.utf8 LC_MONETARY=es_ES.Utf8 LANG=en_US.UTF-8 LC_NUMERIC=es_ES.UTF-8 LC_TELEPHONE=es_ES.utf8 LC_TIME=en_DK.UTF-8 cer@Laicolasse:~> Hum. Some are missing. -- Cheers / Saludos, Carlos E. R. (from openSUSE 15.5 (Laicolasse))
On 01.11.2023 17:27, Carlos E. R. wrote:
On 2023-11-01 15:16, Andrei Borzenkov wrote:
On Wed, Nov 1, 2023 at 5:11 PM Carlos E. R. <robin.listas@telefonica.net> wrote:
Hi,
I have modified .bashrc thus:
if [ $XDG_CURRENT_DESKTOP = KDE ]; then . ~/.i18n echo "changing the locale to .i18n" fi
That part works. At least it runs.
The .i18n file is:
# Add user specific LANG and LC_* variables here # LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES # LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT # LC_IDENTIFICATION LC_ALL # # export LANG=en_US.UTF-8
LC_TIME="en_DK.UTF-8"
LC_MONETARY="es_ES@euro" LC_TELEPHONE="es_ES@euro" LC_MEASUREMENT="es_ES@euro"
LC_MONETARY="es_ES.Utf8" LC_TELEPHONE="es_ES.utf8" LC_MEASUREMENT="es_ES.utf8" LC_NAME="es_ES.utf8" LC_ADDRESS="es_ES.utf8"
LC_ALL=en_US.UTF-8 cer@Laicolasse:~>
When I open a new tab in konsole, or open a new xterm, I notice that the vars are exported:
changing the locale to .i18n cer@Laicolasse:~> locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC=es_ES.UTF-8 LC_TIME=en_DK.UTF-8 LC_COLLATE="en_US.UTF-8" LC_MONETARY=es_ES.Utf8 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=es_ES.utf8 LC_MEASUREMENT=es_ES.utf8 LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= cer@Laicolasse:~>
But not all of them.
Notice that in LC_MONETARY I did a tiny modification (es_ES.Utf8) writing "utf" as "Utf". I did that silly change to see if the var was exported. Now notice "LC_NAME". In the .i18n file, it is "es_ES.utf8", but in the output of locale it is getting "en_US.UTF-8".
Why, what is going on?
You need to export them. Show
env | grep -E 'LANG|LC_'
cer@Laicolasse:~> env | grep -E 'LANG|LC_' LC_MEASUREMENT=es_ES.utf8 LC_MONETARY=es_ES.Utf8 LANG=en_US.UTF-8 LC_NUMERIC=es_ES.UTF-8 LC_TELEPHONE=es_ES.utf8 LC_TIME=en_DK.UTF-8 cer@Laicolasse:~>
Hum. Some are missing.
What is not clear in "you need to export them"?
On 2023-11-01 18:58, Andrei Borzenkov wrote:
On 01.11.2023 17:27, Carlos E. R. wrote:
On 2023-11-01 15:16, Andrei Borzenkov wrote:
On Wed, Nov 1, 2023 at 5:11 PM Carlos E. R. <...> wrote:
...
Why, what is going on?
You need to export them. Show
env | grep -E 'LANG|LC_'
cer@Laicolasse:~> env | grep -E 'LANG|LC_' LC_MEASUREMENT=es_ES.utf8 LC_MONETARY=es_ES.Utf8 LANG=en_US.UTF-8 LC_NUMERIC=es_ES.UTF-8 LC_TELEPHONE=es_ES.utf8 LC_TIME=en_DK.UTF-8 cer@Laicolasse:~>
Hum. Some are missing.
What is not clear in "you need to export them"?
Everything. How do I do that? Why is, for instance, LC_MONETARY exported, but LC_NAME is not? I handle both the same way. -- Cheers / Saludos, Carlos E. R. (from openSUSE 15.5 (Laicolasse))
On 01.11.2023 21:17, Carlos E. R. wrote:
On 2023-11-01 18:58, Andrei Borzenkov wrote:
On 01.11.2023 17:27, Carlos E. R. wrote:
On 2023-11-01 15:16, Andrei Borzenkov wrote:
On Wed, Nov 1, 2023 at 5:11 PM Carlos E. R. <...> wrote:
...
Why, what is going on?
You need to export them. Show
env | grep -E 'LANG|LC_'
cer@Laicolasse:~> env | grep -E 'LANG|LC_' LC_MEASUREMENT=es_ES.utf8 LC_MONETARY=es_ES.Utf8 LANG=en_US.UTF-8 LC_NUMERIC=es_ES.UTF-8 LC_TELEPHONE=es_ES.utf8 LC_TIME=en_DK.UTF-8 cer@Laicolasse:~>
Hum. Some are missing.
What is not clear in "you need to export them"?
Everything.
How do I do that?
Is it a joke? export VARIABLE_NAME assuming you are using bourne-compatible shell.
Why is, for instance, LC_MONETARY exported, but LC_NAME is not?
Because something exported LC_MONETARY before your script was sourced. If you want to know, you can examine environment of parent processes upwards to find out where these variables appeared.
I handle both the same way.
Which does not mean both have the same initial state when you start handling them.
On 2023-11-01 19:38, Andrei Borzenkov wrote:
On 01.11.2023 21:17, Carlos E. R. wrote:
On 2023-11-01 18:58, Andrei Borzenkov wrote:
On 01.11.2023 17:27, Carlos E. R. wrote:
On 2023-11-01 15:16, Andrei Borzenkov wrote:
On Wed, Nov 1, 2023 at 5:11 PM Carlos E. R. <...> wrote:
...
Why, what is going on?
You need to export them. Show
env | grep -E 'LANG|LC_'
cer@Laicolasse:~> env | grep -E 'LANG|LC_' LC_MEASUREMENT=es_ES.utf8 LC_MONETARY=es_ES.Utf8 LANG=en_US.UTF-8 LC_NUMERIC=es_ES.UTF-8 LC_TELEPHONE=es_ES.utf8 LC_TIME=en_DK.UTF-8 cer@Laicolasse:~>
Hum. Some are missing.
What is not clear in "you need to export them"?
Everything.
How do I do that?
Is it a joke?
No.
export VARIABLE_NAME
Ok, so doing . ~/.i18n in .bashrc is not enough, now I have to export individually all the LC_variables one by one, something I wanted to avoid.
assuming you are using bourne-compatible shell.
Why is, for instance, LC_MONETARY exported, but LC_NAME is not?
Because something exported LC_MONETARY before your script was sourced. If you want to know, you can examine environment of parent processes upwards to find out where these variables appeared.
I handle both the same way.
Which does not mean both have the same initial state when you start handling them.
Ok, thanks for the explanation. -- Cheers / Saludos, Carlos E. R. (from openSUSE 15.5 (Laicolasse))
Hi, On Mittwoch, 1. November 2023 15:11:10 CET Carlos E. R. wrote:
Hi,
I have modified .bashrc thus:
if [ $XDG_CURRENT_DESKTOP = KDE ]; then . ~/.i18n echo "changing the locale to .i18n" fi
That part works. At least it runs.
The .i18n file is:
# Add user specific LANG and LC_* variables here # LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES # LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT # LC_IDENTIFICATION LC_ALL # # export LANG=en_US.UTF-8
LC_TIME="en_DK.UTF-8"
LC_MONETARY="es_ES@euro" LC_TELEPHONE="es_ES@euro" LC_MEASUREMENT="es_ES@euro"
LC_MONETARY="es_ES.Utf8" LC_TELEPHONE="es_ES.utf8" LC_MEASUREMENT="es_ES.utf8" LC_NAME="es_ES.utf8" LC_ADDRESS="es_ES.utf8"
LC_ALL=en_US.UTF-8 cer@Laicolasse:~>
When I open a new tab in konsole, or open a new xterm, I notice that the vars are exported:
changing the locale to .i18n cer@Laicolasse:~> locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC=es_ES.UTF-8 LC_TIME=en_DK.UTF-8 LC_COLLATE="en_US.UTF-8" LC_MONETARY=es_ES.Utf8 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=es_ES.utf8 LC_MEASUREMENT=es_ES.utf8 LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= cer@Laicolasse:~>
But not all of them.
Notice that in LC_MONETARY I did a tiny modification (es_ES.Utf8) writing "utf" as "Utf". I did that silly change to see if the var was exported. Now notice "LC_NAME". In the .i18n file, it is "es_ES.utf8", but in the output of locale it is getting "en_US.UTF-8".
Why, what is going on?
maybe KDE overwriting it _after_ .bashrc runs? Is that var immutable?
what does env | grep "LC_" show? Wild guess: The locale command shows the "correct", i.e. existing locales, not the case used in the variable contents.
-- Cheers / Saludos,
Carlos E. R.
Bye. Michael.
On 2023-11-01 15:20, mh@mike.franken.de wrote:
Hi,
On Mittwoch, 1. November 2023 15:11:10 CET Carlos E. R. wrote:
Hi,
I have modified .bashrc thus:
if [ $XDG_CURRENT_DESKTOP = KDE ]; then . ~/.i18n echo "changing the locale to .i18n" fi
That part works. At least it runs.
The .i18n file is:
# Add user specific LANG and LC_* variables here # LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES # LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT # LC_IDENTIFICATION LC_ALL # # export LANG=en_US.UTF-8
LC_TIME="en_DK.UTF-8"
LC_MONETARY="es_ES@euro" LC_TELEPHONE="es_ES@euro" LC_MEASUREMENT="es_ES@euro"
LC_MONETARY="es_ES.Utf8" LC_TELEPHONE="es_ES.utf8" LC_MEASUREMENT="es_ES.utf8" LC_NAME="es_ES.utf8" LC_ADDRESS="es_ES.utf8"
LC_ALL=en_US.UTF-8 cer@Laicolasse:~>
When I open a new tab in konsole, or open a new xterm, I notice that the vars are exported:
changing the locale to .i18n cer@Laicolasse:~> locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC=es_ES.UTF-8 LC_TIME=en_DK.UTF-8 LC_COLLATE="en_US.UTF-8" LC_MONETARY=es_ES.Utf8 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=es_ES.utf8 LC_MEASUREMENT=es_ES.utf8 LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= cer@Laicolasse:~>
But not all of them.
Notice that in LC_MONETARY I did a tiny modification (es_ES.Utf8) writing "utf" as "Utf". I did that silly change to see if the var was exported. Now notice "LC_NAME". In the .i18n file, it is "es_ES.utf8", but in the output of locale it is getting "en_US.UTF-8".
Why, what is going on?
maybe KDE overwriting it _after_ .bashrc runs? Is that var immutable?
what does env | grep "LC_" show? Wild guess: The locale command shows the "correct", i.e. existing locales, not the case used in the variable contents.
No, for LC_MONETARY=es_ES.Utf8 it got the change I made with a case that will not not work. cer@Laicolasse:~> env | grep "LC_" LC_MEASUREMENT=es_ES.utf8 LC_MONETARY=es_ES.Utf8 LC_NUMERIC=es_ES.UTF-8 LC_TELEPHONE=es_ES.utf8 LC_TIME=en_DK.UTF-8 cer@Laicolasse:~> some variables are exported, some are not. -- Cheers / Saludos, Carlos E. R. (from openSUSE 15.5 (Laicolasse))
On 11/1/23 15:11, Carlos E. R. wrote:
Hi,
I have modified .bashrc thus:
if [ $XDG_CURRENT_DESKTOP = KDE ]; then . ~/.i18n echo "changing the locale to .i18n" fi
That part works. At least it runs.
The .i18n file is:
# Add user specific LANG and LC_* variables here # LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES # LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT # LC_IDENTIFICATION LC_ALL # # export LANG=en_US.UTF-8
LC_TIME="en_DK.UTF-8"
LC_MONETARY="es_ES@euro" LC_TELEPHONE="es_ES@euro" LC_MEASUREMENT="es_ES@euro"
LC_MONETARY="es_ES.Utf8" LC_TELEPHONE="es_ES.utf8" LC_MEASUREMENT="es_ES.utf8" LC_NAME="es_ES.utf8" LC_ADDRESS="es_ES.utf8"
LC_ALL=en_US.UTF-8 Besides maybe the exporting issue ... setting LC_ALL overwrites others again according to 'man bash':
LC_ALL This variable overrides the value of LANG and any other LC_ variable specifying a locale category. Have a nice day, Berny
cer@Laicolasse:~>
When I open a new tab in konsole, or open a new xterm, I notice that the vars are exported:
changing the locale to .i18n cer@Laicolasse:~> locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC=es_ES.UTF-8 LC_TIME=en_DK.UTF-8 LC_COLLATE="en_US.UTF-8" LC_MONETARY=es_ES.Utf8 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=es_ES.utf8 LC_MEASUREMENT=es_ES.utf8 LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= cer@Laicolasse:~>
But not all of them.
Notice that in LC_MONETARY I did a tiny modification (es_ES.Utf8) writing "utf" as "Utf". I did that silly change to see if the var was exported. Now notice "LC_NAME". In the .i18n file, it is "es_ES.utf8", but in the output of locale it is getting "en_US.UTF-8".
Why, what is going on?
maybe KDE overwriting it _after_ .bashrc runs? Is that var immutable?
On 2023-11-04 16:48, Bernhard Voelker wrote:
On 11/1/23 15:11, Carlos E. R. wrote:
Hi,
cer@Laicolasse:~>
When I open a new tab in konsole, or open a new xterm, I notice that the vars are exported:
changing the locale to .i18n cer@Laicolasse:~> locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC=es_ES.UTF-8 LC_TIME=en_DK.UTF-8 LC_COLLATE="en_US.UTF-8" LC_MONETARY=es_ES.Utf8 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=es_ES.utf8 LC_MEASUREMENT=es_ES.utf8 LC_IDENTIFICATION="en_US.UTF-8" LC_ALL= cer@Laicolasse:~>
But not all of them.
Notice that in LC_MONETARY I did a tiny modification (es_ES.Utf8) writing "utf" as "Utf". I did that silly change to see if the var was exported. Now notice "LC_NAME". In the .i18n file, it is "es_ES.utf8", but in the output of locale it is getting "en_US.UTF-8".
Why, what is going on?
maybe KDE overwriting it _after_ .bashrc runs? Is that var immutable?
Precisely what I do not want to do ;-) -- Cheers / Saludos, Carlos E. R. (from openSUSE 15.5 (Laicolasse))
participants (4)
-
Andrei Borzenkov
-
Bernhard Voelker
-
Carlos E. R.
-
mh@mike.franken.de