LP refuses to import plural strings where e.g. msgstr[0] entries in PO file miss %d

Bug #1756547 reported by AsciiWolf on 2018-03-17
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Launchpad itself
Undecided
Unassigned
Ubuntu Translations
Medium
Unassigned
gnome-shell (Ubuntu)
Undecided
Gunnar Hjalmarsson

Bug Description

Some strings of GNOME Shell are untranslated in the Czech translation on Ubuntu 18.04 although they are translated upstream and when I try to manually translate them on launchpad, I get this error: "number of format specifications in 'msgid_plural' and 'msgstr[0]' does not match".

The bad strings are:
%d minute ago
%d minutes ago

%d hour ago
%d hours ago

%d week ago
%d weeks ago

%d month ago
%d months ago

%d year ago
%d years ago

They seem to be correct, but they are not accepted for some reason.

Related branches

AsciiWolf (asciiwolf) on 2018-03-17
summary: - Some strings cannot be translate because of an error
+ Some strings cannot be translated because of an error
description: updated

The template provides two alternatives in those cases, a singular and a plural, while some upstream Czech translator has provided three alternatives, for instance:

msgstr[0] "před minutou"
msgstr[1] "před %d minutami"
msgstr[2] "před %d minutami"

So LP refuses to import, and is apparently confused also when you try to fix it via the LP GUI.

I think you should resolve this with the upstream Czech translator(s).

In the meantime you may want to make an experiment: Download the Czech PO file, add translations for msgstr[0] and msgstr[1], remove the lines with msgstr[2], and upload the modified PO file manually.

AsciiWolf (asciiwolf) wrote :

I think this is rather a Launchpad issue. The msgstr[2] is commonly used in GNOME pofiles in our (Czech) language and for example in this case the msgstr[1] and msgstr[2] for "%d years ago" are different. I manually edited and uploaded the pofile, feel free to review it.

Gunnar Hjalmarsson (gunnarhj) wrote :

I approved, and it was imported with the very same errors.

It may well be a LP problem. Can you please file an issue at <https://rt.ubuntu.com>?

Gunnar Hjalmarsson (gunnarhj) wrote :

I opened a bug task for Launchpad itself.

I also picked the Czech .mo file, which was stripped during the build of gnome-shell, and uncompiled it. And indeed it includes msgstr[2] entries.

summary: - Some strings cannot be translated because of an error
+ LP does not understand msgstr[2] entries in PO files
William Grant (wgrant) on 2018-03-28
Changed in launchpad:
status: New → Incomplete
Gunnar Hjalmarsson (gunnarhj) wrote :

There was a long IRC discussion about this issue yesterday:

https://irclogs.ubuntu.com/2018/03/28/%23ubuntu-devel.html#t12:21

I proved to be wrong about what has been causing the import failures: It's not the msgstr[2] entries, but the missing %d in the msgstr[0] entries.

However, the latest gettext version allows such missing %d, while the xenial gettext version does not, and that has been preventing these strings from being imported.

The plan is to upgrade the xenial gettext version in LP and with that solve the problem for both gnome-shell and other affected packages. Hopefully that can be done in due time and proved to work. If not, we also identified a possible workaround which would require certain modifications of the .pot files in all affected packages.

Assigning myself to the Ubuntu Translations bug task for now to more easily monitor the progress.

summary: - LP does not understand msgstr[2] entries in PO files
+ LP refuses to import plural strings where e.g. msgstr[0] entries in PO
+ file miss %d
Changed in ubuntu-translations:
assignee: nobody → Gunnar Hjalmarsson (gunnarhj)
importance: Undecided → High
status: New → In Progress
Sebastien Bacher (seb128) wrote :

William, I guess you set as incomplete for launchpad before the IRC discussion? Seems the consensus was to try to backport the newest gettext and make launchpad use it, Colin started poking at that it seemed?

Changed in launchpad:
status: Incomplete → New
Changed in gnome-shell (Ubuntu):
assignee: nobody → Gunnar Hjalmarsson (gunnarhj)
status: New → In Progress
Jeremy Bicha (jbicha) on 2018-04-06
Changed in gnome-shell (Ubuntu):
status: In Progress → Fix Committed
Gunnar Hjalmarsson (gunnarhj) wrote :

The build of gnome-shell 3.28.0-0ubuntu4 was not sufficient to fix this. The POT file without javascript comments was imported, but LP still complained about the PO files for the affected languages.

The upstream PO files have those javascript comments too. As a test I took the upstream Czech file, removed the javascript comments, and uploaded manually. Imported without errors.

Next thought: Was the first failure about timing, i.e. did LP use the info in the old template to validate the PO files? To test that I took the upstream Serbian file and uploaded it manually without removing the javascript comments. Imported without errors.

Conclusion: A no-change rebuild ought to be sufficient to fix it in gnome-shell for the other affected languages.

Gunnar Hjalmarsson (gunnarhj) wrote :

@AsciiWolf: Do you have an idea which other packages besides gnome-shell suffer from this kind of translation import problem?

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gnome-shell - 3.28.0-0ubuntu4

---------------
gnome-shell (3.28.0-0ubuntu4) bionic; urgency=medium

  * debian/rules:
    - Drop javascript comments in gnome-shell.pot so the currently used
      version of gettext in LP gets more permissive wrt cases where
      the number of %d modifiers in a translation differs from what's
      in msgid (LP: #1756547).

 -- Gunnar Hjalmarsson <email address hidden> Fri, 06 Apr 2018 15:58:00 +0200

Changed in gnome-shell (Ubuntu):
status: Fix Committed → Fix Released
AsciiWolf (asciiwolf) wrote :

@gunnarhj: Sorry, no idea. The only package where I have seen this issue is gnome-shell.

Gunnar Hjalmarsson (gunnarhj) wrote :

To the sponsor: Another upload needed; a no-change build is sufficient.

Changed in gnome-shell (Ubuntu):
status: Fix Released → In Progress
Jeremy Bicha (jbicha) on 2018-04-07
Changed in gnome-shell (Ubuntu):
status: In Progress → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gnome-shell - 3.28.0-0ubuntu5

---------------
gnome-shell (3.28.0-0ubuntu5) bionic; urgency=medium

  * No-change rebuild for translations (LP: #1756547)

 -- Gunnar Hjalmarsson <email address hidden> Sat, 07 Apr 2018 15:58:00 +0200

Changed in gnome-shell (Ubuntu):
status: Fix Committed → Fix Released
Changed in launchpad:
status: New → Confirmed
Changed in ubuntu-translations:
status: In Progress → Triaged
importance: High → Medium
assignee: Gunnar Hjalmarsson (gunnarhj) → nobody
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Bug attachments