mirror of
https://github.com/dec0dOS/zero-ui.git
synced 2025-07-05 20:41:43 -07:00
36 lines
886 B
JavaScript
36 lines
886 B
JavaScript
import i18n from "i18next";
|
|
import languageDetector from "i18next-browser-languagedetector";
|
|
import { initReactI18next } from "react-i18next";
|
|
import Backend from "i18next-http-backend";
|
|
|
|
const userLanguage = window.navigator.language;
|
|
|
|
i18n
|
|
.use(languageDetector)
|
|
.use(initReactI18next)
|
|
.use(Backend)
|
|
.init({
|
|
compatibilityJSON: "v4",
|
|
//lng: "en",
|
|
fallbackLng: "en",
|
|
detection: {
|
|
order: ["path", "cookie", "localStorage", "htmlTag"],
|
|
caches: ["localStorage", "cookie"], // cache user language on
|
|
},
|
|
debug: true,
|
|
//keySeparator: false, // we use content as keys
|
|
interpolation: {
|
|
escapeValue: true,
|
|
},
|
|
react: {
|
|
useSuspense: true,
|
|
},
|
|
supportedLngs: ["en", "es-ES"],
|
|
backend: {
|
|
loadPath: "/locales/{{lng}}/{{ns}}.json",
|
|
},
|
|
ns: ["common"],
|
|
defaultNS: "common",
|
|
});
|
|
|
|
export default i18n;
|