Public bug reported: Consider this: ``` dmitry@MUNIT-517:~$ LANG=C.UTF-8 snap info firefox | grep refresh-date refresh-date: 3 days ago, at 11:52 EET dmitry@MUNIT-517:~$ LANG=ru_RU.UTF-8 snap info firefox | grep refresh-date refresh-date: 3 дня назад в 2626:52 UTC ``` 2626 is a funny hour indeed.
After some research™ I've found out that: 1. Snappy asks gettext for a localized string "%d days ago, at 15:04 MST", 2. gettext finds a string from a language-pack, 3. Then this string is formatted using printf-like format and Go time formatting. This language pack provides those: ``` msgid "%d day ago, at 15:04 MST" msgid_plural "%d days ago, at 15:04 MST" msgstr[0] "%d день назад в 22:04 UTC" msgstr[1] "%d дня назад в 22:04 UTC" msgstr[2] "%d дней назад в 22:04 UTC" ``` Unfortunately, Go time formatting layouts are made by writing out in the way you like a particular magic datetime constant, and layout parser extracts those magic digits to understand which parts of the date are to be printed (see https://pkg.go.dev/time#pkg-constants). So, THE TIME MUST NOT BE LOCALIZED. And there is no way to know that in advance if you aren't aware of the ways of the Go language. Also, the magic datetime is quite funny on it's own. So, just change the lines to: ``` msgid "%d day ago, at 15:04 MST" msgid_plural "%d days ago, at 15:04 MST" msgstr[0] "%d день назад в 15:04 MST" msgstr[1] "%d дня назад в 15:04 MST" msgstr[2] "%d дней назад в 15:04 MST" ``` But you probably need to check the localization of every project written in Go that formats time... I guess if affects all releases... ProblemType: Bug DistroRelease: Ubuntu 22.04 Package: language-pack-ru-base 1:22.04+20240212 ProcVersionSignature: Ubuntu 6.5.0-26.26~22.04.1-generic 6.5.13 Uname: Linux 6.5.0-26-generic x86_64 NonfreeKernelModules: nvidia_modeset nvidia ApportVersion: 2.20.11-0ubuntu82.5 Architecture: amd64 CasperMD5CheckResult: unknown CurrentDesktop: ubuntu:GNOME Date: Fri Mar 29 11:45:24 2024 InstallationDate: Installed on 2022-04-19 (710 days ago) InstallationMedia: Ubuntu 20.04.3 LTS "Focal Fossa" - Release amd64 (20210819) PackageArchitecture: all SourcePackage: language-pack-ru-base UpgradeStatus: Upgraded to jammy on 2022-08-21 (585 days ago) ** Affects: language-pack-ru-base (Ubuntu) Importance: Undecided Status: New ** Tags: amd64 apport-bug jammy ** Description changed: Consider this: ``` dmitry@MUNIT-517:~$ LANG=C.UTF-8 snap info firefox | grep refresh-date refresh-date: 3 days ago, at 11:52 EET dmitry@MUNIT-517:~$ LANG=ru_RU.UTF-8 snap info firefox | grep refresh-date refresh-date: 3 дня назад в 2626:52 UTC ``` 2626 is a funny hour indeed. After some research™ I've found out that: 1. Snappy asks gettext for a localized string "%d days ago, at 15:04 MST", - 2. gettext founds a string from a language-pack, + 2. gettext finds a string from a language-pack, 3. Then this string is formatted using printf-like format and Go time formatting. This language pack provides those: ``` msgid "%d day ago, at 15:04 MST" msgid_plural "%d days ago, at 15:04 MST" msgstr[0] "%d день назад в 22:04 UTC" msgstr[1] "%d дня назад в 22:04 UTC" msgstr[2] "%d дней назад в 22:04 UTC" ``` Unfortunately, Go time formatting layouts are made by writing out in the way you like a particular magic datetime constant, and layout parser extracts those magic digits to understand which parts of the date are to be printed (see https://pkg.go.dev/time#pkg-constants). So, THE TIME MUST NOT BE LOCALIZED. And there is no way to know that in advance if you aren't aware of the ways of the Go language. Also, the magic datetime is quite funny on it's own. So, just change the lines to: ``` msgid "%d day ago, at 15:04 MST" msgid_plural "%d days ago, at 15:04 MST" msgstr[0] "%d день назад в 15:04 MST" msgstr[1] "%d дня назад в 15:04 MST" msgstr[2] "%d дней назад в 15:04 MST" ``` But you probably need to check the localization of every project written in Go that formats time... I guess if affects all releases... ProblemType: Bug DistroRelease: Ubuntu 22.04 Package: language-pack-ru-base 1:22.04+20240212 ProcVersionSignature: Ubuntu 6.5.0-26.26~22.04.1-generic 6.5.13 Uname: Linux 6.5.0-26-generic x86_64 NonfreeKernelModules: nvidia_modeset nvidia ApportVersion: 2.20.11-0ubuntu82.5 Architecture: amd64 CasperMD5CheckResult: unknown CurrentDesktop: ubuntu:GNOME Date: Fri Mar 29 11:45:24 2024 InstallationDate: Installed on 2022-04-19 (710 days ago) InstallationMedia: Ubuntu 20.04.3 LTS "Focal Fossa" - Release amd64 (20210819) PackageArchitecture: all SourcePackage: language-pack-ru-base UpgradeStatus: Upgraded to jammy on 2022-08-21 (585 days ago) -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2059766 Title: Snapd date localization is VERY MUCH wrong To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/language-pack-ru-base/+bug/2059766/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs