Page MenuHomePhabricator

GettextFFS should implement isContentEqual
Closed, ResolvedPublic

Description

FFS::isContentEqual is used to implement string equality comparison for translations. This is important because translation string might differ even though the contents are equal. Example:

Translator writes:

The bunnies stole {{PLURAL:GETTEXT|one carrot|%{count} carrots}}.

This might be exported as:

0: The bunnies stole one carrot.
1: The bunnies stole %{count} carrots.

When the system then flattens then again, it produces:

{{PLURAL:GETTEXT|The bunnies stole one carrot.|The bunnies stole %{count} carrots.}}

isContentEqual should return true for this string and what the translator wrote, to avoid FuzzyBot replacing the first form with the latter form after export-import roundtrip. That's easy to implement with GettextPlural::unFlatten.

Event Timeline

Florian subscribed.

It's late, but I imported this task into GCI as https://codein.withgoogle.com/dashboard/tasks/4964700098396160/ Let's see if someone claims this in the last days of the contest :)

Change 566074 had a related patch set uploaded (by Majavah; owner: Majavah):
[mediawiki/extensions/Translate@master] Override isContentEqual in GettextFFS

https://gerrit.wikimedia.org/r/566074

I added a patch that seems to work. I was not sure about the value for $expectedPluralCount, 2 seems to work but I'm not really familiar with Translate so there might be some cases where it will not work.

Change 566074 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] Override isContentEqual in GettextFFS

https://gerrit.wikimedia.org/r/566074