On Sat, Nov 21, 2015 at 2:52 AM, Andrew Sutherland <
[email protected]> wrote:

>
> But this is where we get into a terminology problem.  What would be
> desired is for that front-end provided logic to be running in the
> back-end's Worker/SharedWorker/ServiceWorker.  So it is front-end logic,
> but in a back-end context, in a way.  And it looks like all the code in
> https://github.com/mozilla-b2g/gaia/blob/master/shared/js/intl/ is
> assuming that it's operating in a Window, not a *Worker.  (Or maybe that's
> misleading and a side-effect of an overzealous transpiler/bundler?)
>
> So I guess my question is: Is it currently possible or eventually planned
> to allow the l20n.js code to run in a worker context?


Currently it's not possible to run the l20n "service" in a worker context,
but the client/service split is recent and we're definitely working towards
the goal of making that possible!

The reason we currently refer to document and window is that we store the
state of the language negotiation in the l20n service and to set the
initial value we need to read the list of available languages from the
document's <head>, and also need a way to react to the language changes on
the window's languagechange event.  This is currently done in
l20n-service.js but I have an idea how to move this to the client.  With
that change, we should be able to run the service in a worker context, and
that's something I really really want because I'd like to move l20n into a
service worker in the future.

I filed https://bugzilla.mozilla.org/show_bug.cgi?id=1228348 to track this.

-stas
_______________________________________________
dev-fxos mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-fxos

Reply via email to