pontoon icon indicating copy to clipboard operation
pontoon copied to clipboard

There should a preview area for Fluent strings

Open bugzilla-to-github opened this issue 5 years ago • 7 comments

This issue was created automatically by a script.

Bug 1648734

Bug Reporter: @flodolo CC: [email protected], @guerojeff, @mathjazz

I've been doing a few reviews on mozilla.org, and translating has become incredibly hard because of the number of terms. Take for example this string:

compare-brave-comparing-firefox-browser = Comparing { -brand-name-firefox-browser } to { -brand-name-brave }

There's a steep learning curve there, especially if you have defined complex terms like Italian:

navigation-firefox-browser-for-desktop = { -brand-name-firefox-browser } for Desktop
navigation-firefox-browser-for-desktop = { -brand-name-firefox-browser(capitalization: "uppercase") } per desktop

Making people, especially non programmers, understand Fluent terms is hard. And I often have to chase down a term definition myself to confirm which case is the default.

I think it would be great to have a preview for Fluent strings, similarly to what happens in the Fluent Playground. It might not be useful for plain strings, but it definitely is for strings with terms, and probably for plurals.

I'm aware there are a few challenges to solve (e.g. where are terms defined and how do I create a context with all the terms? Which value should I use for a variable? etc.), but I think these are solvable technical details, and that's worth the effort to make Fluent easier to understand for localizers.

bugzilla-to-github avatar Jun 25 '20 21:06 bugzilla-to-github

Comment Author: @mathjazz

It would also help if we showed what the term resolves into on hover.

We should be able to do that even in the editor if we switched from textarea to a rich editor, which would also allow us to autocomplete Terms.

bugzilla-to-github avatar Jun 25 '20 21:06 bugzilla-to-github

Comment Author: @Pike

A couple of questions for the spec:

What happens if there's no term? What happens if there are multiple? Which value do we show? See bug #1597692 for an example outside of localizer control, but also Terms with VariableReferences in the SelectExpression.

At the point where the UI knows about the Term, it could also suggest select expressions if the Term has attributes, but that's probably for another feature spec.

bugzilla-to-github avatar Jun 25 '20 21:06 bugzilla-to-github

Comment Author: @flodolo

What happens if there's no term?

As in, the term is not defined, or not translated in the locale?

I think it would be helpful to mimic the actual behavior of products, but I'm afraid that might be different depending on the product. a) What happens in Firefox if the term is untranslated? IIRC, we don't fall back, we show the term. b) What happens in mozilla.org?

I would somehow signal that there's an issue, e.g. {MISSING-TERM} for Desktop for { -brand-name-firefox-browser } for Desktop, if the term is untranslated, or {UNDEFINED-TERM} for Desktop if it's completely undefined in the source locale.

We already have warnings from compare-locales around terms, but we have locales sometimes using a different term (think German and brand-shorter-name instead of brand-short-name). It would be helpful to catch undefined terms.

That clearly comes with limitations, given you don't actually know the context used in the product (which files are loaded).

What happens if there are multiple?

Multiple definition of the terms? I think that's an error that should be caught in review, to be honest. I'd be OK with just overriding the term with the latest translation available if there are multiple definitions.

Which value do we show? See bug #1597692 for an example outside of localizer control, but also Terms with VariableReferences in the SelectExpression.

Could you give me an example of the latter?

But yes, that's one of the challenges. Maybe we should just pick the default form in a select expression, to avoid adding some sort of interactivity in the preview.

bugzilla-to-github avatar Jun 25 '20 22:06 bugzilla-to-github

Comment Author: @Pike

So, brands.ftl on moz.org will only be exposed in one toolchain, not in others. So yes, the term might not exist at all.

OTH, we could expose -brand-short-name from both official and nightly branding files in the source code, and at build time pick one or the other. Then you'd had multiple Entities for the same Term Id.

Variable reference is in https://transvision.mozfr.org/string/?entity=browser/browser/branding/sync-brand.ftl:-sync-brand-name&repo=gecko_strings#cs, for example.

bugzilla-to-github avatar Jun 26 '20 00:06 bugzilla-to-github

Comment Author: @flodolo

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

Variable reference is in https://transvision.mozfr.org/string/?entity=browser/browser/branding/sync-brand.ftl:-sync-brand-name&repo=gecko_strings#cs, for example.

In that case we would know which string to pick, wouldn't we? It's the same as the Italian example above.

bugzilla-to-github avatar Jun 26 '20 01:06 bugzilla-to-github

Comment Author: @flodolo

*** Bug #1654973 has been marked as a duplicate of this bug. ***

bugzilla-to-github avatar Jul 23 '20 14:07 bugzilla-to-github

See also:

  • #2363

mathjazz avatar Nov 11 '21 14:11 mathjazz