mirror of
https://github.com/dec0dOS/zero-ui.git
synced 2025-07-07 05:21:40 -07:00
feat: i18n
This commit is contained in:
parent
d65e6fb71a
commit
61fd0e7186
24 changed files with 416 additions and 79 deletions
32
frontend/src/i18n.js
Normal file
32
frontend/src/i18n.js
Normal 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;
|
Loading…
Add table
Add a link
Reference in a new issue