Hi Pascal!

> Am 09.01.2015 um 16:10 schrieb [email protected]:
> 
> Thanks for your suggestion Niels.
> 
> It's working. It has a nice "side effect" : you can easily load a new 
> language and switch language dynamically, by setting translationLoaded to 
> false then to true.

That’s cool. Data binding rocks ;-)

> However, I've add difficulties to make translationLoaded kind of global.
> I eventually managed it by using this 
> https://www.polymer-project.org/docs/polymer/polymer.html#global

What I do in my current project is to have a common element that all my custom 
elements extend. I’ve added a ‘g’ attribute on it that gets populated with an 
object containing global state in the ready callback. That way, I can still 
easily override values for quick testing of individual elements by setting ‘g’ 
to something sensible (<my-element g='{"foo“: "bar“}’></my-element>).

> So now all my polymer elements should look like this  (always including the 
> i18n-element to gain access to the global translation loaded parameter.
> 
> <polymer-element name="my-element">
>  <template>
>  <i18n-element id="translations"></i18n-element>
>     <div>
>      Translation in my-element: {{ 'Hello' | _($.translations.data.loaded) }}
>  </div>
>  </template>
> 
> 
> I need to think a bit more about it, to see if I prefer this way of doing, or 
> a more simple syntax but without async loading.

The biggest problem I see with asynchronously loading translations is that 
having a flash of untranslated content is not very desirable. 

Cheers,

Niels

Follow Polymer on Google+: plus.google.com/107187849809354688692
--- 
You received this message because you are subscribed to the Google Groups 
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/polymer-dev/DDB5E13A-B430-485E-A13A-507620DFFE84%40halbordnung.de.
For more options, visit https://groups.google.com/d/optout.

Reply via email to