[Go Faster] L10n for system addons (Page Shot in 54)

Shane Caraveo scaraveo at mozilla.com
Tue Mar 7 21:11:21 UTC 2017


On 2017-03-06 11:06 PM, Francesco Lodolo [:flod] wrote:
> Il 07/03/17 02.46, Jared Hirsch ha scritto:
>> Hi all,
>>
>> I'm working on a localization plan for Page Shot in FF 54, and I'm
>> curious if anyone on the list has suggestions (best practices or
>> gotchas) related to l10n in system addons.
>>
>> Page Shot includes a WebExtension (in a bootstrapped addon wrapper)
>> and a website. The site runs on nodejs and its views are built with
>> react, while the addon's views are built using raw browser APIs (DOM
>> built-ins + innerHTML). Both parts of the project live inside the same
>> Github repo.
>>
>> The current draft plan is to connect Pontoon to the Page Shot Github
>> repo[1] to pull in translated strings, try out fluent-react[2] for the
>> server, and fluent.js[3] for the addon. For language negotiation on
>> both addon and server, we're going to try out the fluent-langneg[4]
>> library. This plan doesn't (yet) include anything specific to Page
>> Shot shipping as a system addon. Feedback is very welcome :-)
>>
>> I also have two questions for folks on the list. First, for language
>> negotiation, should the addon follow the user's content language
>> preference, or should it match the UI language? Second, should we plan
>> to ship one system addon containing all locales, or should we plan to
>> build one addon for each locale?
> Hi Jared,
> The only localized system add-on I'm familiar with is Pocket [1], but
> the solution used for it won't be applicable to a WebExtension. Pocket

Hello also used the same mechanism that pocket does, I pretty much 
duplicated what Hello did.

One key item to understand is, if shipping as a system addon, and you do 
out-of-band gofaster updates, you'll need to include all supported 
locales.

A problem that you may run into with webextensions doing this is how you 
deal with default_locale given a localized distro.  You cannot change 
default_locale per distro without having multiple addons with unique 
signatures.  Given the way fallback works, you may need to give this 
some thought.

> We use an external l10n repository (GitHub) and Pontoon to localize
> those strings, in .properties format, then dump updates periodically in
> mozilla-central. More important, Pocket uses Firefox build system,

I haven't thought deeply about what l10n build would look like if Pocket 
were moved to a webextension.  However, at a basic level I'd probably 
consider a couple scripts that can convert from the properties files 
into the json format used by the webextension system to allow Pontoon 
use for providing translations.

> If I'm not forgetting things, the only WebExtension we have localized so
> far is SnoozeTabs, and it converts from the original JSON format to a
> .properties file supported by localization tools.

And that sounds like my thoughts above.  It might be good to get those 
scripts into a place they can be used generally by other projects.

Shane



More information about the Gofaster mailing list