@sap-ux/store
Version:
NPM module for storing persistent data
25 lines • 770 B
JavaScript
import i18next from 'i18next';
import translations from './translations/ux-store.i18n.json' with { type: 'json' };
const NS = 'ux-store';
let i18nInstance = i18next.createInstance();
export async function initI18n() {
i18nInstance = i18next.createInstance({
resources: {
en: {
[NS]: translations
}
},
lng: 'en',
fallbackLng: 'en',
defaultNS: NS,
fallbackNS: 'default',
ns: [NS],
interpolation: { escapeValue: false },
showSupportNotice: false
});
await i18nInstance.init();
}
export function text(key, options) {
return i18nInstance.t(key, typeof options === 'string' ? { defaultValue: options } : options);
}
//# sourceMappingURL=i18n.js.map