mathjazz / pontoon

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

[FTL] problem while saving FTL string with only "other" plural variant in string #1196

Open mathjazz opened 4 years ago

mathjazz commented 4 years ago

This issue was created automatically by a script.

Bug 1589113

Bug Reporter: Håvar I. Henriksen [:havarh] <havar@firefox.no> CC: @flodolo, @Pike

Created attachment 9101569 User interface shown when FTL is activated.

I just tried to translate string number 204799 for Firefox, but I got an error "The following checks has failed. Expected value" when I tried to save the translation since the string only had an "other" in the plural variant of the string. That is, the "one" plural variant is empty. See screen shot. What I had to do is turn off FTL for that string, and then copy over the English FTL code and edit that directly. The comment on this string reads: "This number will always be greater than 1", and that's why the "one" plural form is missing.

https://pontoon.mozilla.org/translate/nb-NO/firefox/all-resources/?string=204799

mathjazz commented 4 years ago

Comment Author: Håvar I. Henriksen [:havarh] <havar@firefox.no>

Created attachment 9101570 User interface shown when FTL is deactivated.

If I turn of FTL this code is shown, and this is where I had to copy in the English code and then edit that. I guess I also could've just removed the [one] part of the string.

Attached file: Screenshot-2019-10-16-16.19.11.png (image/png, 172010 bytes) Description: User interface shown when FTL is deactivated.

mathjazz commented 4 years ago

Comment Author: @Pike

The right answer for Fluent is to not have an expression at all, and just use the plain value. en-US is wrong there, too, I think.

Maybe that's an OK compromise for now as we don't have UX to add plurals yet in the rich editor, but we intend to make compare-locales complain about select expression with just one variant.

mathjazz commented 4 years ago

Comment Author: Håvar I. Henriksen [:havarh] <havar@firefox.no>

I just randomly checked Sorbian, Lower, and here the localizer has manually added several plurals.

{ $blockedCount ->
    [one] { -brand-short-name } jo zablokěrował wušej <b>{ $blockedCount }</b> pśeslědowaka wót { $date }!
    [two] { -brand-short-name } jo zablokěrował wušej <b>{ $blockedCount }</b> pśeslědowakowu wót { $date }!
    [few] { -brand-short-name } jo zablokěrował wušej <b>{ $blockedCount }</b> pśeslědowakow wót { $date }!
   *[other] { -brand-short-name } jo zablokěrował wušej <b>{ $blockedCount }</b> pśeslědowakow wót { $date }!
}
mathjazz commented 4 years ago

Comment Author: @Pike

The opposite, actually. Pontoon sees a select expression in English, and then suggests the right plural variants for the current language.

What it can't do is offering "pluralize on $blockedCount", for a message that's just a simple pattern in English w/out any select expression.

mathjazz commented 4 years ago

Comment Author: @flodolo

(In reply to Axel Hecht [:Pike] from comment #2)

The right answer for Fluent is to not have an expression at all, and just use the plain value. en-US is wrong there, too, I think.

Just to confirm, we use this to trigger the plural UI, otherwise most locales won't have an idea on how to switch to the plural form from a simple message. The other way around (plural -> simple message) is relatively straightforward, and doesn't require you knowing how to write Fluent syntax by heart.