Google Groups unterstützt keine neuen Usenet-Beiträge oder ‑Abos mehr. Bisherige Inhalte sind weiterhin sichtbar.

L20n.js: v2 and v3 AST

19 Aufrufe
Direkt zur ersten ungelesenen Nachricht

Staś Małolepszy

ungelesen,
01.07.2015, 07:02:5801.07.15
an tools...@lists.mozilla.org
We've developed a new AST for L20n.js v3 which is faster and leaner than v2:
https://github.com/l20n/l20n.js/pull/42

At the same time, I'm working on moving the entire Gaia build system to v3:
https://bugzil.la/1169361

On buildtime, we do two things:
- pretranslate HTML into the default language; this doesn't depend on the
version of the AST at all,

- parse l10n resources and serialize them into JSONs; since right now v2
and v3 use the same AST, using v3 for serialization here works for apps
using v2; it won't work once we merge #42.

We have three options:

1. backport the same AST to v2,

This is fairly easy because the parser and resolver interfaces haven't
changed much between v2 and v3. I'm not sure however how much work we want
to put into v2 any more. Not much, I assume.

2. in Gaia buildtime, use v3 for producing JSONs in app using v3, and use
v2 for apps using v2; use v3 to pretranslate all apps.

This semantically makes sense, but it complicates the code of
webapp-optimize and removes the biggest win of https://bugzil.la/1169361
which is the fact that all of the l10n logic is require()'ed instead of
being run in a mock window.

It's probably the easiest option and it allows us to move on fast. It will
create some technical debt since we'll need to support both v2 and v3 in
the buildtime going forward.

3. land v2 parser in v3 (bindings/gaiabuild/parser?) and subclass Env to
use it for parsing and give it a special createEntries method which knows
how to read that v2 AST.

I like this option because it allows us to completely move to v3 for
buildtime. Moreover, as long as the AST stays the same, we can mostly
focus on v3 going forward and cover all the bases.

Thoughts?
-stas
0 neue Nachrichten