mathjazz / pontoon

In-place localization tool
https://pontoon.mozilla.org/
BSD 3-Clause "New" or "Revised" License
3 stars 1 forks source link

Singular form option disappears when copying from the original text #1262

Open mathjazz opened 3 years ago

mathjazz commented 3 years ago

This issue was created automatically by a script.

Bug 1686427

Bug Reporter: @cesperanc CC: @flodolo, @mathjazz

Created attachment 9196792 Singular form option disappeared on copy.gif

Hi.

I've encountered an strange behaviour when I try to copy an original string with multiple plural form options: when I copy the original source string, the singular form disappears and only the plural form is available for translation (I've attached an animation which hopefully should demonstrate the issue).

Thanks for the assistance.

mathjazz commented 3 years ago

Comment Author: @flodolo

That seems the correct behavior to me.

The original string has only the other variant. That is done explicitly to trigger the plural UI in Pontoon, since English doesn't actually need the singular form.

if you copy the en-US string, it will only have one variant (other). If you need others, you'll need to switch to the FTL mode and manually change the syntax.

mathjazz commented 3 years ago

Comment Author: @cesperanc

In that case, shouldn't the Copy function replace only the "other" variant while keeping the other variants specified in the locale (e.g. "singular" form) empty or with the same value of "other"?

mathjazz commented 3 years ago

Comment Author: @flodolo

COPY is designed to copy the entire en-US string as-is, not work on singular fields/attributes.

What you're asking would be a different feature, e.g. a COPY FIELD, but I'm not sure how useful it would be, since you can manually copy the value from the resource section.

mathjazz commented 3 years ago

Comment Author: @cesperanc

Created attachment 9196814 Input fields disappear when FTL mode is toggled.gif

Attached file: Input fields disappear when FTL mode is toggled.gif (image/gif, 152277 bytes) Description: Input fields disappear when FTL mode is toggled.gif

mathjazz commented 3 years ago

Comment Author: @cesperanc

My only concern is that some translators will press the Copy button and lose information about all the plural forms set for the locale because the original text doesn't need those plural forms. They probably will never switch to FTL mode to fix the issue, and the product will probably ship with those mistakes (and no easy way to detect those issues). Also if the copy action is destructible (because the FTL format is permanently changed on copy), it should be possible to undo that action without having to refresh the page.

I've also found another issue: when I press the FTL button and if I don't do any change, the locale default format is lost (I've attached another animation to show what I meant).

mathjazz commented 3 years ago

Comment Author: @mathjazz

Flod is right - COPY copies the entire string. The problem with copying only the corresponding variants (i.e. other to other, one to one, etc.) is that sometimes the target locale could not have any of the variants in the source string.

Maybe renaming the button from COPY to CLONE could help. We could also trigger unsaved changes warning before copying. Implementing the Undo feature would require a bit more work. Would any of these be sufficient?

Could you please file a separate bug for the issue with the editor going blank (black)?

mathjazz commented 3 years ago

Comment Author: @cesperanc

(In reply to Matjaz Horvat [:mathjazz] from comment #6)

Flod is right - COPY copies the entire string. The problem with copying only the corresponding variants (i.e. other to other, one to one, etc.) is that sometimes the target locale could not have any of the variants in the source string.

Maybe renaming the button from COPY to CLONE could help. We could also trigger unsaved changes warning before copying. Implementing the Undo feature would require a bit more work. Would any of these be sufficient?

Yes I think CLONE is a more appropriate name. Personally I would prefer a COPY and MERGE option, but I understand that may be unfeasible for all contexts.

Could you please file a separate bug for the issue with the editor going blank (black)?

I've filed a separate bug 1688589.

Thanks for the help