On 05/04/16 13:10, [email protected] wrote:
Something else, we can't ship a product that needs to download an l10n pack on 
first run. So we're going to have to bundle the strings with the product, which 
means the lookup can always be synchronous.
Actually, that's one of the lessons from gecko that we brought into the design. String look-ups must be fallible (see also the hello bustage we just had on beta). Now, if a string fails, we need to look up a fallback, which means that during the call, we'd have to do blocking mainthread sync IO to get and parse the English strings. Or we'd need to take the perf hit to always load and parse at least twice as many strings in localized builds as we do in en-US.

That's why all l10n getters are async in the next world of l10n.

Axel

Maybe the impedance mismatch for devtools is too high?

Joe.

On Friday, April 1, 2016 at 6:17:34 PM UTC+1, Joe Walker wrote:
(Repost - message bounced because it was too long)

Thanks for this Stas, it's a really interesting exploration of the options.

In devtools, we're using Redux, and I'm curious about using the context
because that makes re-rendering on new l10n data difficult. Do you know how
this would work?

The low-fi thing for us to do with Redux is to include the l10n object in
the global state and have a FETCHED_L10N_DATA action which makes the l10n
object render different text. Then the l10n object would either be passed
down the tree, or injected with the connect([mapStateToProps]...) function
[1].

So a lightweight component could look simply like this.

const Component = ({ l10n, ...otherProps }) => (
   <span {...{ otherProps }}>l10n('hello-world')</span>
);

When the strings file is received, we'd need to dispatch the
FETCHED_L10N_DATA, but that's fairly simple.

I appreciate that you weren't really looking at Redux, but does this
approach make sense? Did I miss anything?

Thanks
Joe.

On Thu, Mar 31, 2016 at 12:10 PM Staś Małolepszy <[email protected]> wrote:

Here are my thoughts and rough notes on integrating L20n with React.
<snip>


_______________________________________________
tools-l10n mailing list
[email protected]
https://lists.mozilla.org/listinfo/tools-l10n

Reply via email to