2022-12-24 18:23:21 +00:00
|
|
|
import i18n from 'i18next';
|
|
|
|
import Backend from 'i18next-http-backend';
|
2023-02-04 00:36:31 +00:00
|
|
|
import { initReactI18next } from 'react-i18next';
|
2023-03-27 14:49:52 +00:00
|
|
|
|
2023-06-29 01:24:20 +00:00
|
|
|
// TODO: Disabled for IDE performance issues with our translation JSON
|
2023-07-22 13:26:14 +00:00
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
2023-06-29 01:24:20 +00:00
|
|
|
// @ts-ignore
|
2023-05-11 14:09:01 +00:00
|
|
|
import translationEN from '../public/locales/en.json';
|
2023-03-27 14:49:52 +00:00
|
|
|
|
|
|
|
if (import.meta.env.MODE === 'package') {
|
|
|
|
i18n.use(initReactI18next).init({
|
|
|
|
lng: 'en',
|
|
|
|
resources: {
|
|
|
|
en: { translation: translationEN },
|
2022-12-24 18:23:21 +00:00
|
|
|
},
|
2023-03-27 14:49:52 +00:00
|
|
|
debug: false,
|
2022-12-24 18:23:21 +00:00
|
|
|
interpolation: {
|
|
|
|
escapeValue: false,
|
|
|
|
},
|
|
|
|
returnNull: false,
|
|
|
|
});
|
2023-03-27 14:49:52 +00:00
|
|
|
} else {
|
|
|
|
i18n
|
|
|
|
.use(Backend)
|
2023-05-12 09:35:03 +00:00
|
|
|
// .use(
|
|
|
|
// new LanguageDetector(null, {
|
|
|
|
// lookupLocalStorage: `${LOCALSTORAGE_PREFIX}lng`,
|
|
|
|
// })
|
|
|
|
// )
|
2023-03-27 14:49:52 +00:00
|
|
|
.use(initReactI18next)
|
|
|
|
.init({
|
|
|
|
fallbackLng: 'en',
|
|
|
|
debug: false,
|
|
|
|
backend: {
|
2024-01-24 01:03:09 +00:00
|
|
|
loadPath: `${window.location.href.replace(/\/$/, '')}/locales/{{lng}}.json`,
|
2023-03-27 14:49:52 +00:00
|
|
|
},
|
|
|
|
interpolation: {
|
|
|
|
escapeValue: false,
|
|
|
|
},
|
|
|
|
returnNull: false,
|
|
|
|
});
|
|
|
|
}
|
2022-12-24 18:23:21 +00:00
|
|
|
|
|
|
|
export default i18n;
|