This post is relevant to an environment running Gnome 46 and Gnome Files 46.1 (Ubuntu 24.04).
Gnome’s Control Center region/locale settings are intentionally mutable/configurable by the user to set/determine the preferred formats, but Gnome Files (Nautilus) is not honoring the user chosen date format(s) when the Detailed preference is set for Date and Time Format.
This became a point of focus for me because I prefer an ISO-esque date format in my file manager's list view. I stumbled upon this Gnome Discourse thread, which led me down the path to accomplish this.
Screenshot showing locale settings in system preferences, as well as Gnome Files’ non-conforming format.
Process
- Create a nautilus.po file with the following contents.
#. Translators: date and time in 24h format,
#. * i.e. "2023-12-31 23:59"
#: src/nautilus-date-utilities.c:83
#, no-c-format
msgid "%m/%d/%Y %H:%M"
msgstr "%Y-%m-%d %H:%M"
#. Translators: date and time in 12h format,
#. * i.e. "2023-12-31 11:59 PM"
#: src/nautilus-date-utilities.c:90
#, no-c-format
msgid "%m/%d/%Y %I:%M %p"
msgstr "%Y-%m-%d %I:%M %p"
- Convert this to a .mo file using
msgfmt
(from gettext).
msgfmt nautilus.po -o nautilus.mo
- Copy the .mo file to /usr/share/locale/en/LC_MESSAGES
This requires sudo
privs.
Note: Replace "en" with your current locale language directory.
sudo cp nautilus.mo /usr/share/locale/en/LC_MESSAGES/
- Reboot and verify Gnome Files is now showing dates in the preferred format based on the custom translation provides.