UNPKG

yahoi

Version:

Yet Another Highly Opinionated Isomorphic Framework

40 lines (38 loc) 922 B
const i18n = require('i18next'); const XHR = require('i18next-xhr-backend'); const LanguageDetector = require('i18next-browser-languagedetector'); const options = { fallbackLng: 'en', load: 'languageOnly', debug: true, saveMissing: false, backend: { //load:['en', 'de'], loadPath: '/Translations/get?lng={{lng}}&ns={{ns}}', defaultNS: 'Common', addPath: '/Translations/add?lng={{lng}}&ns={{ns}}', crossDomain: true, allowMultiLoading: true }, react: { wait: false, exposeNamespace: true }, interpolation: { escapeValue: false, formatSeparator: ',', format: (value, format, lng) => { return "1"; if (format === 'uppercase') return value.toUpperCase(); return value; } } }; if (process.browser) { i18n .use(XHR) // .use(Cache) //.use(LanguageDetector); } if (!i18n.isInitialized) i18n.init(options); module.exports = i18n;