In 18.04 change language of date?
So just updated to 18.04 and one thing really bugs me, the date given by Gnome is written in my native language while I prefer the date to be given in English. So instead of: "za 19:24" in Dutch I'd rather have: "sat 19:24" in English. I found the setting to change formats but I'd like to preserve the other options of the Dutch format (i.e how numbers are shown). Is it possible to change the Dutch format to basically have the date/day displayed in English or make my own custom format?
Thanks in advance!
Solution 1:
The locale for numbers is called:
LC_NUMERIC
How you format your numbers. For example,
in many countries a period (.) is used as a
decimal separator, while others use a comma (,).
and for date/time is:
LC_TIME
How your time and date are formatted.
Use for example "en_DK.UTF-8" to get a 24-hour-clock
in some programs.
Change LC_TIME to US and you will see american style date, but since LC_NUMERIC is not changed numbers stay as is.
Example:
rinzwind@schijfwereld:~$ date
za 4 aug 2018 21:20:11 CEST
rinzwind@schijfwereld:~$
rinzwind@schijfwereld:~$ LC_TIME=en_US.UTF-8
rinzwind@schijfwereld:~$
rinzwind@schijfwereld:~$ locale
LANG=en_US.UTF-8
LANGUAGE=
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=
rinzwind@schijfwereld:~$ date
Sat Aug 4 21:16:53 CEST 2018
If you like it, change:
/etc/default/locale
to make it permanent.
Solution 2:
You should be aware that there are two locale settings. One that is used before the user login, and another after the user login. Furthermore, simply editing the /etc/default/locale is likely not to work because it will be overwritten by the "Regional Formats" set on the GUI.
Using locale
it will inform you the locale preferences currently being used. Using localectl status
will let you know the preferences used before user login, like on the login screen.
If you want to edit the locale for your user, the first thing you want to know is which locales are available. For that, type locale -a
. After checking that your locale of choice is already installed (you will likely want to check ifen_US.utf8
is available).
Now, the file you want to edit is ~/.pam_environment
. This is the one that will determine the regional settings used after being logged in. You can open it with your editor of choice (no need for sudo). In your case you want to edit simply the time settings, so go over to that line and replace it with LC_TIME=en_US.UTF-8
and leave the others with your country settings.
If you also want that change to take effect when in the login screen you should use sudo update-locale LC_TIME=en_US.UTF-8
.
Note that changes only happen after a fresh login or system restart.
Relevant: https://help.ubuntu.com/community/Locale