} } }, (err: any, t: i18next.TranslationFunction) => { // init set content updateContent(); }); i18next.init({ ns: ['common', 'moduleA', 'moduleB'], defaultNS: 'moduleA' }, (err: any, t: i18next.TranslationFunction) => { i18next.t('myKey'); // key in moduleA namespace (defined default) i18next.t('common:myKey'); // key in common namespace }); i18next.loadNamespaces('anotherNamespace', (err: any, t: i18next.TranslationFunction) => { /* ... */ }); // fallback to one language i18next.init({ lng: 'en-GB' }, () => { i18next.t('i18n'); // -> "Internationalisation" i18next.t('i18n_short'); // -> "i18n" (from en.json) // force loading en i18next.t('i18n', { lng: 'en' }); // -> "Internationalization" }); // fallback to one language i18next.init({ fallbackLng: 'en'
}, ); i18next.init( { ns: ['common', 'moduleA', 'moduleB'], defaultNS: 'moduleA', }, (err, t) => { t('myKey'); // key in moduleA namespace (defined default) t('common:myKey'); // key in common namespace }, ); i18next.loadNamespaces('anotherNamespace', (err, t) => { /* ... */ }); // fallback to one language i18next.init( { lng: 'en-GB', }, () => { i18next.t('i18n'); // -> "Internationalisation" i18next.t('i18n_short'); // -> "i18n" (from en.json) // force loading en i18next.t('i18n', { lng: 'en' }); // -> "Internationalization" }, );