import i18n from "i18next"; import { initReactI18next } from "react-i18next"; import en from "@/locales/en/common.json"; import am from "@/locales/am/common.json"; import { useLangStore } from "@/lib/stores/langStore"; const initial = useLangStore.getState().language; void i18n.use(initReactI18next).init({ compatibilityJSON: "v4", resources: { en: { translation: en }, am: { translation: am }, }, lng: initial, fallbackLng: "en", interpolation: { escapeValue: false }, }); useLangStore.subscribe((state) => { void i18n.changeLanguage(state.language); }); export default i18n;