Snapd date localization is VERY MUCH wrong

Bug #2059766 reported by Dmitry Lapshin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
language-pack-ru-base (Ubuntu)
New
Undecided
Unassigned

Bug Description

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)

Revision history for this message
Dmitry Lapshin (lapshin-dv) wrote :
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.