Config:
const i18nConfig = {
settings: {
defaultLocale: "en",
ru: {
code: "ru",
isoCode: "ru-RU",
name: "Русский"
},
en: {
code: "en",
isoCode: "en-US",
name: "English"
}
},
ru: {
property: "значение",
},
en: {
property: "value"
}
};
Initialize:
import I18N from 'meteor/ostrio:i18n';
const i18n = new I18N({i18n: i18nConfig});
React:
i18n.setLocale('en');
i18n.get('property'); // -> value
i18n.setLocale('ru');
i18n.get('property'); // -> значение
You can use same in a Blaze helpers, or use TemplateHelper i18n:
<p>{{i18n 'property'}}</p> <!-- value -->