I have a Polymer app with many templates, in which I would like to manage localization. I use app-localize-behavior for that. I found a nice way of managing localization from a single file. The solution proposed there uses behaviors, and requires little additions in each template, with a unique json data file.
My problem is that I would like to be able to change the language dynamically, and probably store it in a app-localstorage-document element, which I manage from another file. How can I set this language property from outside this file?
<link rel="import" href="../../bower_components/polymer/polymer.html">
<link rel="import" href="../../bower_components/app-localize-behavior/app-localize-behavior.html">
<script>
MyLocalizeImpl = {
properties: {
language: {
value: 'fr'
}
},
attached: function() {
this.loadResources(this.resolveUrl('../locales.json'));
},
};
MyLocalize = [MyLocalizeImpl, Polymer.AppLocalizeBehavior];
</script>