mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-12-09 09:46:36 +00:00
27 lines
693 B
TypeScript
27 lines
693 B
TypeScript
import i18n from "i18next";
|
|
import { initReactI18next } from "react-i18next";
|
|
import LanguageDetector from "i18next-browser-languagedetector";
|
|
import resourcesToBackend from "i18next-resources-to-backend";
|
|
import { languages } from "./locales";
|
|
|
|
i18n
|
|
.use(LanguageDetector)
|
|
.use(initReactI18next)
|
|
.use(
|
|
resourcesToBackend(
|
|
(language: string) => import(`./locales/${language}.json`),
|
|
),
|
|
)
|
|
.init({
|
|
fallbackLng: "en",
|
|
debug: import.meta.env.MODE === "development",
|
|
nonExplicitSupportedLngs: true,
|
|
supportedLngs: Object.keys(languages),
|
|
load: "currentOnly",
|
|
detection: {
|
|
lookupLocalStorage: "tinyauth-lang",
|
|
},
|
|
});
|
|
|
|
export default i18n;
|