You are not logged in.
I want to have english text but swedish date formats and other values, so I have my locale set up as sv_SE with locale-gen, and in ~/.bashrc I have:
export LANG="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
export LC_NUMERIC="sv_SE.UTF-8"
export LC_TIME="en_DK.UTF-8"
export LC_COLLATE="en_US.UTF-8"
export LC_MONETARY="sv_SE.UTF-8"
export LC_MESSAGES="en_US.UTF-8"
export LC_PAPER="sv_SE.UTF-8"
export LC_NAME="en_US.UTF-8"
export LC_ADDRESS="en_US.UTF-8"
export LC_TELEPHONE="sv_SE.UTF-8"
export LC_MEASUREMENT="sv_SE.UTF-8"
export LC_IDENTIFICATION="en_US.UTF-8"in terminal I get this output when running "locale" command:
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LC_NUMERIC=sv_SE.UTF-8
LC_TIME=sv_SE.UTF-8
LC_COLLATE=en_US.UTF-8
LC_MONETARY=sv_SE.UTF-8
LC_MESSAGES=en_US.UTF-8
LC_PAPER=sv_SE.UTF-8
LC_NAME=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_TELEPHONE=sv_SE.UTF-8
LC_MEASUREMENT=sv_SE.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_ALL=However the date format is "MM/DD/YY HH:mm", which is definitely not sv_SE locale.
I also tried changing the LC_TIME to en_DK according to some suggestions in other forums, but still the same.
So why would my date format in thunderbird and pcmanfm (and probably other software as well) show the wrong date format locale?
Last edited by 7thSon (2017-08-05 10:02:42)
Offline
I have swedish formats and english text. I'll give you a notification when back home. Don't remember the exact config, but it was fairly easy. (Perhaps you will get help before i get home, but just in case)
I possess a device, in my pocket, that is capable of accessing the entirety of information known to man.
I use it to look at funny pictures of cats and to argue with strangers.
Offline
Did you edit /etc/locale.gen and run locale-gen?
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Did you edit /etc/locale.gen and run locale-gen?
Yes, it was en_US before, I changed it to sv_SE, but no change.
Offline
As a sanity check, could you run
localectl list-localesSakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Mine:
[arch@dome ~]$ locale -a
C
en_US.utf8
POSIX
sv_SE.utf8
[arch@dome ~]$ locale
LANG=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LC_NUMERIC=en_US.UTF-8
LC_TIME=sv_SE.UTF-8
LC_COLLATE=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8
LC_PAPER=sv_SE.UTF-8
LC_NAME=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_TELEPHONE=sv_SE.UTF-8
LC_MEASUREMENT=sv_SE.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_ALL=
[arch@dome ~]$ localectl list-locales
en_US.utf8
sv_SE.utf8I possess a device, in my pocket, that is capable of accessing the entirety of information known to man.
I use it to look at funny pictures of cats and to argue with strangers.
Offline
WorMzy wrote:Did you edit /etc/locale.gen and run locale-gen?
Yes, it was en_US before, I changed it to sv_SE, but no change.
Changed it to? You need to have all of the ones you want uncommented. If you're just switching back and forth with only one uncommented, it won't work.
Offline
7thSon wrote:WorMzy wrote:Did you edit /etc/locale.gen and run locale-gen?
Yes, it was en_US before, I changed it to sv_SE, but no change.
Changed it to? You need to have all of the ones you want uncommented. If you're just switching back and forth with only one uncommented, it won't work.
That was indeed an error on my part, I uncommented both sv_SE, en_US and en_DK now and rebooted, but the date format is still wrong.
Output
[user@arch ~]$ locale -a
C
en_DK.utf8
en_US.utf8
POSIX
sv_SE.utf8
[user@arch ~]$ locale
LANG=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LC_NUMERIC=sv_SE.UTF-8
LC_TIME=en_DK.UTF-8
LC_COLLATE=en_US.UTF-8
LC_MONETARY=sv_SE.UTF-8
LC_MESSAGES=en_US.UTF-8
LC_PAPER=sv_SE.UTF-8
LC_NAME=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_TELEPHONE=sv_SE.UTF-8
LC_MEASUREMENT=sv_SE.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_ALL=
[user@arch ~]$ localectl list-locales
en_DK.utf8
en_US.utf8
sv_SE.utf8Offline
After you uncomment a line in /etc/locale.gen you have to run locale-gen again. Didn't see you stating that. Reboot wont help.
I possess a device, in my pocket, that is capable of accessing the entirety of information known to man.
I use it to look at funny pictures of cats and to argue with strangers.
Offline
It's in "locale -a", though.
Question: how *exactly* do you determine the time format?
Because as for thunderbird: while I don't use it but am gonna bet that mozilla simply ignores your locale settings in favor of an own config key.
Pcmanfm however reacts to the locale setting and has YYYY-MM-DD for sv_SE.UTF-8 and en_DK.UTF-8 as LC_TIME
Compare
date +%x
LC_TIME=sv_SE.UTF-8 date +%x
LC_TIME=en_DK.UTF-8 date +%x
LC_TIME=en_US.UTF-8 date +%xOnline
After you uncomment a line in /etc/locale.gen you have to run locale-gen again. Didn't see you stating that. Reboot wont help.
Yes I actually did do locale-gen after the changes, just forgot to mention it.
It's in "locale -a", though.
Question: how *exactly* do you determine the time format?
Because as for thunderbird: while I don't use it but am gonna bet that mozilla simply ignores your locale settings in favor of an own config key.
Pcmanfm however reacts to the locale setting and has YYYY-MM-DD for sv_SE.UTF-8 and en_DK.UTF-8 as LC_TIMECompare
date +%x LC_TIME=sv_SE.UTF-8 date +%x LC_TIME=en_DK.UTF-8 date +%x LC_TIME=en_US.UTF-8 date +%x
I don't really understand your question on how I determine the time format, but what I want is the output of LC_TIME=sv_SE.UTF-8 date +%x.
In my terminal however, just doing date +%x actually shows the swedish format YYYY-MM-DD, so the question then I guess is why doesn't pcmanfm?
I don't know if thunderbird uses its own format, but at least pcmanfm should show the correct format if it uses the system locale as you say.
EDIT:
I just tried running "LC_TIME=sv_SE.UTF-8 thunderbird" and that manages to run thunderbird with the correct swedish date format, however if I do the same with pcmanfm, it still shows the wrong format.
Last edited by 7thSon (2017-08-04 11:23:21)
Offline
In my terminal however, just doing date +%x actually shows the swedish format YYYY-MM-DD, so the question then I guess is why doesn't pcmanfm?
I'm guessing because you don't start pcmanfm from an interactive bash session. You never said/showed anything about actually setting the locale, except for exporting those variables in ~/.bashrc.
Offline
I'm guessing because you don't start pcmanfm from an interactive bash session. You never said/showed anything about actually setting the locale, except for exporting those variables in ~/.bashrc.
I think you're right, if I just run "pcmanfm" in a terminal, the date format is correct, same if I run "thunderbird" in terminal.
However if I understand correctly my locale is actually set, the ouput from "locale" in terminal is:.
[user@arch ~]$ locale
LANG=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LC_NUMERIC=sv_SE.UTF-8
LC_TIME=sv_SE.UTF-8
LC_COLLATE=en_US.UTF-8
LC_MONETARY=en_US.UTF-8
LC_MESSAGES=en_US.UTF-8
LC_PAPER=sv_SE.UTF-8
LC_NAME=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_TELEPHONE=sv_SE.UTF-8
LC_MEASUREMENT=sv_SE.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_ALL=And I also put all those above lines into /etc/locale.conf to set the system locale. Am I still missing something?
Last edited by 7thSon (2017-08-04 11:56:13)
Offline
Save this as "env_of" or so, make it executable and run "env_of pcmanfm | grep LC" with a "broken" pcmanfm up.
Also provide the output of "localectl" and explain how you usually run pcmanfm, what kind of desktop session this is, how you log in etcetc.
#!/bin/sh
if [[ $1 =~ "^[0-9]+$" ]]; then
tr '\0' '\n' < /proc/$1/environ
else
for PID in `pidof $1`; do
echo -e "$PID ( $(</proc/$PID/cmdline) )\n====================================="
tr '\0' '\n' < /proc/$PID/environ
echo -e "===================================================\n"
done
fiOnline
Save this as "env_of" or so, make it executable and run "env_of pcmanfm | grep LC" with a "broken" pcmanfm up.
Also provide the output of "localectl" and explain how you usually run pcmanfm, what kind of desktop session this is, how you log in etcetc.
#!/bin/sh if [[ $1 =~ "^[0-9]+$" ]]; then tr '\0' '\n' < /proc/$1/environ else for PID in `pidof $1`; do echo -e "$PID ( $(</proc/$PID/cmdline) )\n=====================================" tr '\0' '\n' < /proc/$PID/environ echo -e "===================================================\n" done fi
Here is the output from env_of:
[user@arch .scripts]$ sh env_of.sh pcmanfm | grep LC
env_of.sh: line 6: warning: command substitution: ignored null byte in input
LC_MEASUREMENT=en_GB.UTF-8
LC_PAPER=sv_SE.UTF-8
LC_MONETARY=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_COLLATE=en_US.UTF-8
LC_CTYPE=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_NUMERIC=sv_SE.UTF-8
LC_MESSAGES=en_US.UTF-8
LC_TELEPHONE=sv_SE.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_TIME=en_GB.UTF-8Output of localectl:
System Locale: LANG=en_US.UTF-8
LC_NUMERIC=sv_SE.UTF-8
LC_TIME=sv_SE.UTF-8
LC_PAPER=sv_SE.UTF-8
LC_TELEPHONE=sv_SE.UTF-8
LC_MEASUREMENT=sv_SE.UTF-8
VC Keymap: sv-latin1
X11 Layout: seMy desktop session is XFCE, I have autologin set up via ~/.bash_profile which runs "startxfce4".
Usually I run pcmanfm with a keyboard shortcut which launches /usr/bin/pcmanfm (this is set via XFCE keyboard shortcuts).
...And I just found that in ~/.bash_profile there were two lines; "export LC_TIME=en_GB.UTF-8" and "export LC_MEASUREMENT=en_GB.UTF-8"...
Will try removing these, since they have to be the source of the en_GB ouput from your script.
...And it works! So ~/.bash_profile was the culprit since it seems to apply its lines after .bashrc.
Just a small follow up question; I see that the calendar is now also set correctly with monday as the first day of the week, but the day names are in swedish, can this be changed?
EDIT: Yes, I fixed it by copying the day and month names from en_US into sv_SE and running locale-gen.
Thanks for the help, will mark this solved!
Last edited by 7thSon (2017-08-05 10:02:28)
Offline
What's the purpose of "LC_TIME=sv_SE.UTF-8"? If it's only about getting "2017-08-05" instead of "08/05/2017", en_DK should do that and provide you English names rather than Swedish (or Danish) ones (w/o messing around with the locale files)
Online
What's the purpose of "LC_TIME=sv_SE.UTF-8"? If it's only about getting "2017-08-05" instead of "08/05/2017", en_DK should do that and provide you English names rather than Swedish (or Danish) ones (w/o messing around with the locale files)
You're right, en_DK probably would have done the same thing, I just didn't think of that at the time.
Offline