Closed Bug 1441020 Opened 6 years ago Closed 6 years ago

[FTL] Approving pre-0.6 syntax suggestions creates duplicate translations

Categories

(Webtools Graveyard :: Pontoon, enhancement, P2)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: theo, Assigned: mathjazz)

Details

Attachments

(1 file)

Trying to approve a suggestion from someone else in a FTL file, Pontoon duplicates the suggestion and creates a new one attributed to me, and makes it the approved translation.


Example here: https://pontoon.mozilla.org/fr/firefox-screenshots/all-resources/?search=R%C3%A9initialiser&string=174451 The currently approved translation should be Alpha’s suggestion from 3 months ago. Instead, Pontoon duplicated the suggestion and attributed it to me.
They're actually different, because the FTL syntax changed a couple of weeks ago.

Your string (note the equal sign after the ID):

annotationClearButton =
    .title = Réinitialiser


Alpha's string

annotationClearButton
    .title = Réinitialiser

You can only see it if you switch to FTL advance mode (i.e. source view)
One way around this is to migrate all the existing translations to new syntax. And sync changes to VCS.
Summary: [FTL] Approving someone else’s suggestion creates a duplicate suggestion and attributes it to the approver → [FTL] Approving pre-0.6 syntax suggestions creates duplicate translations
How does Pontoon decide to change the author of the suggestion? Does it do a string comparison on the serialized translation? If so, could we change it to compare the AST of the message instead?
BaseNode.equals (https://github.com/projectfluent/python-fluent/blob/0.6.3/fluent/syntax/ast.py#L76) is intended to compare two AST nodes. There's no JS counterpart right now.
(In reply to Staś Małolepszy :stas from comment #3)
> How does Pontoon decide to change the author of the suggestion? Does it do a
> string comparison on the serialized translation? If so, could we change it
> to compare the AST of the message instead?

Yes, Pontoon compares Translation.string values, which in case of FTL translations means serialized Messages.

I don't think storing AST as JSON in Translation.string would help here, because the AST also changed in 0.6.

BTW, in the past Pontoon used to store AST as JSON in Translation.string, but we swiched to serialized values after Barcelona, because the syntax was "stable" at that time. :-))
I still think storing the serialized values is the right approach. Comparing two serialized values is best done via parseEntry and BaseNode.equals.
You're talking about comparing, not storing - sorry.

Is the plan to continue supporting both, the 0.4 and 0.6 syntax?
(In reply to Matjaz Horvat [:mathjazz] from comment #7)
> Is the plan to continue supporting both, the 0.4 and 0.6 syntax?

Stas?

If not, we'll need to do the migration to new syntax at some point anyways.

If yes, I'd still rather do the migration than add complexity to the code.
Flags: needinfo?(stas)
Priority: -- → P2
We'll support Syntax 0.4 in the near future (including the 0.7 releases of fluent-syntax and python-fluent). After that I'd like to plan ending its support. We'll need to make sure we don't have any strings using the old syntax anymore.

(In reply to Matjaz Horvat [:mathjazz] from comment #8)
> If not, we'll need to do the migration to new syntax at some point anyways.
> If yes, I'd still rather do the migration than add complexity to the code.

This x2.
Flags: needinfo?(stas)
Commit pushed to master at https://github.com/mozilla/pontoon

https://github.com/mozilla/pontoon/commit/a122b830ef1f64ae6d1a745ebcf169fb5fcd52ed
Fix bug 1441020: Migrate FTL translations to latest syntax (#893)

And also to the latest serializer output. Also: migrate TM entries.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Assignee: nobody → m
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: