A behavior to help with internationalizating apps
npm install @polymer/app-localize-behavior


app-localize-behavior is a behavior that wraps the format.js library toSee: Documentation,
Demo.
npm install --save @polymer/app-localize-behavior
`$3
`html
`$3
`js
import {PolymerElement, html} from '@polymer/polymer';
import {mixinBehaviors} from '@polymer/polymer/lib/legacy/class.js';
import {AppLocalizeBehavior} from '@polymer/app-localize-behavior/app-localize-behavior.js';class SampleElement extends mixinBehaviors([AppLocalizeBehavior], PolymerElement) {
static get template() {
return html
;
} static get properties() {
return {
language: { value: 'en' },
}
}
function attached() {
this.loadResources(this.resolveUrl('locales.json'));
}
}
customElements.define('sample-element', SampleElement);
`Contributing
If you want to send a PR to this element, here are
the instructions for running the tests and demo locally:$3
`sh
git clone https://github.com/PolymerElements/app-localize-behavior
cd app-localize-behavior
npm install
npm install -g polymer-cli
`$3
`sh
polymer serve --npm
open http://127.0.0.1:/demo/
`$3
`sh
polymer test --npm
``