import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import LanguageDetector from "i18next-browser-languagedetector";

import commonEn from "./locales/en/common.json";
import authEn from "./locales/en/auth.json";
import adminEn from "./locales/en/admin.json";
import wizardEn from "./locales/en/wizard.json";
import editorEn from "./locales/en/editor.json";

i18n
  .use(LanguageDetector)
  .use(initReactI18next)
  .init({
    resources: {
      en: {
        common: commonEn,
        auth: authEn,
        admin: adminEn,
        wizard: wizardEn,
        editor: editorEn,
      },
    },
    defaultNS: "common",
    fallbackLng: "en",
    interpolation: {
      escapeValue: false,
    },
  });

export default i18n;
