Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should load json5 data', done => {
backend = new XHR(
{
interpolator: i18next.services.interpolator,
},
{
loadPath: 'http://localhost:9876/locales/{{lng}}/{{ns}}.json5',
parse: JSON5.parse,
},
);
backend.read('en', 'test', function(err, data) {
expect(err).to.be.not.ok;
expect(data).to.eql({ key: 'passing' });
done();
});
});
});
before(() => {
backend = new XHR(
{
interpolator: i18next.services.interpolator,
},
{
loadPath: 'http://localhost:9876/locales/{{lng}}/{{ns}}.json',
},
);
});
i18next.on('initialized', () => {
i18next.services.resourceStore.addResourceBundle(lang, i18next.options.ns[0], json, true, true);
});
}
i18next.on('initialized', () => {
i18next.services.resourceStore.addResourceBundle(lang, i18next.options.ns[0], json);
});
}
i18next.on('initialized', () => {
i18next.services.resourceStore.addResourceBundle(lang, i18next.options.ns[0], json);
});
}
export default function localize(node, retranslate) {
const recurseTime = new Instrument();
recurseTime.start();
const localized = walk(node, null, null, null, null, { retranslate });
i18next.services.logger.log(`localization took: ${recurseTime.end()}ms`);
return localized;
}
function log() {
i18next.services.logger.log('missing resources: \n' + JSON.stringify(missings, null, 2));
}
uiSettings.on('change', settings => {
const lang = settings.i18nLang === LANGUAGE_DEFAULT
? i18n.services.languageDetector.detect()
: settings.i18nLang;
i18n.changeLanguage(lang);
});