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.

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

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.

Thanks a lot.




On Tuesday, January 6, 2015 at 4:38:19 PM UTC+1, Niels Grewe wrote:
>
> Hi Pacal, 
>
> > Am 06.01.2015 um 16:10 schrieb [email protected] <javascript:>: 
> > 
> > I was however wondering if it is possible to have the {{}} expressions 
> evaluated after the translations have been loaded. 
>
> It could be done with a custom filter bound to translationLoaded. For 
> example instead of having ‘{{_('Hello')}}’ you would have {{'Hello‘ | 
> _(translationLoaded)}}. As long as translationLoaded is false, you would 
> just return the argument unchanged from the filter, and once it’s updated 
> to be true, you run the argument through the translation mechanism. 
>
> 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/33460871-3524-4c27-9cfd-a6986a91262b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to