import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import { getDefaultLanguage, translationResources } from "./helper";

i18n.use(initReactI18next).init({
  //  debug: true,
  resources: translationResources,
  returnNull: false, // update the initialization so the behavior matches the type (don't return null)
  lng: getDefaultLanguage(),
  supportedLngs: ["ar", "en"],
  fallbackLng: "en",
  interpolation: {
    escapeValue: false, // not needed for react as it escapes by default
  },
  react: {
    useSuspense: true,
  },
});

export default i18n;
