add package mode option for i18next

This commit is contained in:
Mary Hipp 2023-03-27 10:49:52 -04:00
parent 1f0324102a
commit 92e512b8b6

View File

@ -1,8 +1,23 @@
import i18n from 'i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import Backend from 'i18next-http-backend';
import { initReactI18next } from 'react-i18next';
import translationEN from '../dist/locales/en.json';
if (import.meta.env.MODE === 'package') {
i18n.use(initReactI18next).init({
lng: 'en',
resources: {
en: { translation: translationEN },
},
debug: false,
interpolation: {
escapeValue: false,
},
returnNull: false,
});
} else {
i18n
.use(Backend)
.use(LanguageDetector)
@ -18,5 +33,6 @@ i18n
},
returnNull: false,
});
}
export default i18n;