For example if i would like to define text messages in multiple languages:
const AVAILABLE_LANGUAGES = ["en", "fr"];
const CONFIRM_BUTTON_TEXT = { "en": "Confirm", "fr": "Confirm in french"};
Then somewhere in a component template be able to use them like:
<button>@{global.CONFIRM_BUTTON_TEXT.en}</button>
or in a component script or controller like:
var default_language = global.AVAILABLE_LANGUAGES[0];
- where should I define those constants for best practice
- how can I access them in components with javascript
- how can I access them in html templates
- how can I access them in controllers