Closed kingctan closed 8 years ago
Hi, you can use this way:
// file: i18n/en.js
I18n.translations.EN = {
"name_placeholder": "your name"
};
// file: i18n/cs.js
I18n.translations.CS = {
"name_placeholder": "tvé jméno"
};
Please use method onLangChange
(of Snippet or Scene) to set placeholder. This method is called every time, when the language of application is changed.
// file: scene/testScene.js
/**
* @inheritdoc Scene#init
*/
init: function() {
this.input = new Input(null, {placeHolder: __('name_placeholder')});
this.input.create(this.$el.find(".input-cover"));
},
/**
* @inheritdoc Scene#onLangChange
*/
onLangChange: function (firstTime, lang) {
this.input.placeHolder = __('name_placeholder'); // set new localized placeholder
if(this.input.getValue().length === 0) {
this.input.setPlaceholder(true); // redraw placeholder, if it is visible
}
},
Regards Radim
how to translate input's placeholder with I18N?