authelia/web/src/i18n/index.ts
James Elliott 4503ac07be
fix(web): lowercase locales are not consistent with localization platforms (#3141)
This fixes an issue with localization platforms and the docs regarding localization, and the forcing locale names to lowercase.
2022-04-08 14:53:46 +10:00

33 lines
844 B
TypeScript

import i18n from "i18next";
import LanguageDetector from "i18next-browser-languagedetector";
import Backend from "i18next-http-backend";
import { initReactI18next } from "react-i18next";
i18n.use(Backend)
.use(LanguageDetector)
.use(initReactI18next)
.init({
detection: {
order: ["querystring", "navigator"],
lookupQuerystring: "lng",
},
backend: {
loadPath: "/locales/{{lng}}/{{ns}}.json",
},
ns: ["portal"],
defaultNS: "portal",
fallbackLng: {
default: ["en"],
},
load: "all",
supportedLngs: ["en", "es", "de"],
lowerCaseLng: false,
nonExplicitSupportedLngs: true,
interpolation: {
escapeValue: false,
},
debug: false,
});
export default i18n;