Closed ravirupapara closed 9 years ago
I am using, Node 0.12.7, and es6 I have installed using : npm install i18next here is the code,
import i18next from 'i18next';
/** * @class * StorageInternationalizer manages translation using i18next */ export default class Internationalizer { constructor(options = {}) { this.locale = options.locale; this.key = options.key; this.defaultLocale = options.defaultLocale || 'en'; this.init(this.locale); this.translate(this.locale, this.key); } init(locale) { i18next.init(this.configurationFor(locale)); } configurationFor(locale) { return {resStore: {locale: {translation: JSON.parse(window.localStorage.getItem(locale))}}}; } translate(locale, key) { return key ? this.translation(locale, key) : this.allTranslations(locale); } translation(key) { return i18next.t(key); } allTranslations(locale) { let translations = window.localStorage.getItem(locale || this.defaultLocale); return JSON.parse(translations); } }
Can any one help to get translated value by i18next.t(key) ?
Duplicate of https://github.com/i18next/i18next/issues/416
I'll close this issue since you are not using ng-i18next. I'll try to answer your question in your other issue :)
ng-i18next
I am using, Node 0.12.7, and es6 I have installed using : npm install i18next here is the code,
import i18next from 'i18next';
Can any one help to get translated value by i18next.t(key) ?