strolch-wc-localize-behavior/strolch-localize-behavior.html

24 lines
917 B
HTML

<link rel="import" href="../app-localize-behavior/app-localize-behavior.html">
<script>
// global variables holding the language tag and the URL to the locales.json
var strolchLocalLanguage = undefined;
var strolchLocalResourceUrl = undefined;
// custom behaviour accessing the configuration above
StrolchLocalizeBehaviorImpl = {
attached: function() {
if(!strolchLocalLanguage || !strolchLocalResourceUrl) {
console.log("warning: localization not configured");
return;
}
// load the language resource of the configured language
this.language = strolchLocalLanguage;
this.loadResources(strolchLocalResourceUrl);
}
};
// inherit the behavior of the standard polymer localization
StrolchLocalizeBehavior = [Polymer.AppLocalizeBehavior, StrolchLocalizeBehaviorImpl];
</script>