feat: i18n

This commit is contained in:
Andres 2023-10-16 17:34:52 +02:00
parent d65e6fb71a
commit 61fd0e7186
24 changed files with 416 additions and 79 deletions

32
frontend/src/i18n.js Normal file
View file

@ -0,0 +1,32 @@
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: userLanguage || "en",
fallbackLng: "en",
debug: true,
//keySeparator: false, // we use content as keys
interpolation: {
escapeValue: true,
},
react: {
useSuspense: false,
},
supportedLngs: ["en", "es", "es-ES"],
backend: {
loadPath: "/locales/{{lng}}/{{ns}}.json",
},
ns: ["translation"],
defaultNS: "translation",
});
export default i18n;