create-next-core-base
Version:
CLI tool to create Next Base projects with feature selection
30 lines (27 loc) • 716 B
text/typescript
// src/i18n/client.ts
import i18n from "i18next";
import LanguageDetector from "i18next-browser-languagedetector";
import HttpBackend from "i18next-http-backend";
import { initReactI18next } from "react-i18next";
void i18n
.use(HttpBackend)
.use(LanguageDetector)
.use(initReactI18next)
.init({
fallbackLng: "fa",
supportedLngs: ["fa", "en"],
ns: ["common", "landing", "footer", "navbar"],
defaultNS: "common",
debug: false,
interpolation: {
escapeValue: false,
},
detection: {
order: ["localStorage", "cookie", "navigator"],
caches: ["localStorage"],
},
backend: {
loadPath: "/locales/{{lng}}/{{ns}}.json",
},
});
export default i18n;