I recently installed Fedora Asahi Remix on my M2 Macbook Pro. The installation was super smooth and honestly took me by surprise - I went from curl
to a fully-operational Linux distro in about 5 minutes.
However, I was frustrated with the region and locale settings. I wanted to use the American English defaults for everything except for date and time, which should be formatted yyyy-MM-dd
(year-month-day, numerical) and HH:mm
(24 hour time with leading 0s), respectively.
As an aside: the point-and-click method for changing the region (System Settings -> Region and Language) is kind of finicky - sometimes the changes take effect immediately, sometimes they take effect but the system settings show the old settings until you reboot, and sometimes the settings don't take effect at all until a reboot.
Anyway, I thought the C locale was close enough:
This uses the three-letter abbreviation instead of the number of the month, which wasn't a deal breaker. However, for some reason it does include seconds on the time on the lock screen (HH:mm:ss
) and I did not want this. Displaying seconds does consume more battery but mostly I just didn't like it this way. While probably not a big deal (how often is the lock screen actually displayed?), it's not what I wanted.
After a little more searching, I found exactly what I wanted in English (Sweden), aka en_SE
.
The only problem: when attempting to select this locale, I received an error: Could not find the system's available locales using the localectl tool. Please file a bug report about this at https://bugs.kds.org
Despite being listed as an option, The en_SE
locale was not actually available to use, which was VERY confusing. How could it give me examples of what the current date and time would look like in this format if it didn't have access to that format? I also found a few other locales with this same listed-but-not-actually-useable issue. I did find this error referenced on the KDE bug tracker, but unfortunately I didn't find any easy solutions (e.g. https://bugs.kde.org/show_bug.cgi?id=479213)
At this point I knew it was time to stop playing around with the GUI and use a terminal. I opened Konsole and ran localectl list-locales | grep en
to show the list of available English locales on my system, and sure enough en_SE
was not one of them.
I had never added a new locale to any operating system before, but I guess this was as good a time as ever to learn how. I read the Fedora documentation for configuring the system locale, read the man page for locale files, and luckily also stumbled across some other internet folk who had this same issue and a similar desire to make dates and times look the way they want. I learned that you can create a properly formatted locale definition file, build it with localedef
, and make it available for use in the localectl
tool (and also it'll actually work in the system settings GUI).
Coincidentally, at least one other person must have gone through this exact process with the en_SE
locale because I found a gist with a locale definition and build instructions for a version of the en_SE
locale. This locale file still had Swedish settings for telephone number formatting and default paper size, which I did not want, so I forked the gist and modified the locale definition and build instructions slightly:
I confirmed the freshly built, custom en_SE
locale was available for use:
Time for the test - would activating this locale actually do what I want? I had already become familiar with the terminal-based locale configuration tools, so I decided to set the locale there rather than in the system settings GUI. I also decided to use the en_SE
locale only for the time, rather than set it as the global locale. This pretty much negated the changes I made in my version of the locale definition file (since we're only using the date and time format anyway):
sudo localectl set-locale LC_TIME=en_SE.UTF-8
I had to restart for the changes to take effect, but I finally got what I wanted.
This was a lot of work just to make the date and time look how I wanted, but I did learn a fair bit about locales in Linux. To be honest though, the date format in the C locale (dd-mmm-yyyy
, e.g. 26 Jan 2024
) is growing on me. It totally removes any confusion about whether the first number refers to the day or the month (i.e. is it MM-dd-yyyy
or dd-MM-yyyy
?) The good news is now I know how to make a custom locale file to do what I want, because I still don't want to see seconds on my lock screen.
Alternatively, I could spend my time doing anything else. We'll see what happens.