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.
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