Decreasing number of plural forms makes some data invalid

Bug #195779 reported by Данило Шеган
4
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Medium
Jeroen T. Vermeulen

Bug Description

If a language has it's own number of plural forms decreased, previously distinct TranslationMessages would now appear the same.

Example: a language might have 2 pluralforms, and two different translation messages A and B for a single potmsgset (eg. A.msgstr0=1, A.msgstr1=2 and B.msgstr0=1, B.msgstr1=3). When we reduce the number of plural forms for a language to 1, when trying to update this translation, a selectOne in _findTranslationMessage would return two messages instead of only one.

Currently, we have a problem with 17 messages like this in our database, and they are all for 1 plural form languages. See https://pastebin.canonical.com/2812/

There are different approaches to fixing this: fix the existing data, and make sure such messages are cleared up when the number of pluralforms for a language is reduced, or use all 4/6 pluralforms for finding matching translationmessages (which might make it impossible to activate existing translation, eg. an imported one, if it had more plural forms on import, but would instead create a new message).

Revision history for this message
Данило Шеган (danilo) wrote :

What exactly failed: https://pastebin.canonical.com/2813/ (from launchpad-errors-list)

Changed in rosetta:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Indeed, all these cases have only msgstr0 and msgstr1 translated, so it looks like a transition from the default 2 forms to 1 form.

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Here's some SQL to clean up at least the most blatant of these:

  https://pastebin.canonical.com/3361/

This deals with those messages that are duplicates, for languages with 1 form, in POFiles whose headers say they have only one plural form.

All these messages are from 2006 or older, although some of them are current. Deleting duplicates should do no great harm.

Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

A more thorough version of the same SQL statement: https://pastebin.canonical.com/3396/

This deletes the redundant messages regardless of the nplurals value in their POFile headers. The problem turns out not to be sensitive to that, and the extra translations wouldn't be shown anyway.

Changed in rosetta:
assignee: nobody → jtv
milestone: none → 2.2.1
status: Confirmed → In Progress
Changed in rosetta:
status: In Progress → Fix Committed
Changed in rosetta:
status: Fix Committed → Fix Released
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.