import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import detector from 'i18next-browser-languagedetector';
import en from './locales/en/common.json';
import zh_CN from './locales/zh_CN/common.json';

i18n
  .use(detector)
  .use(initReactI18next)
  .init({
    supportedLngs: ['en', 'zh_CN'],
    resources: {
      en: { common: en },
      zh_CN: { common: zh_CN },
    },
    defaultNS: 'common',
    fallbackLng: ['en', 'zh_CN'],
    react: {
      useSuspense: false,
    },
  });

export default i18n;
