import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';

// Import translation files
import idTranslations from '../locales/id.json';
import cnTranslations from '../locales/cn.json';

const resources = {
  id: {
    translation: idTranslations,
  },
  cn: {
    translation: cnTranslations,
  },
};

i18n
  .use(initReactI18next)
  .init({
    resources,
    lng: 'id', // Default language
    fallbackLng: 'id',
    interpolation: {
      escapeValue: false, // React already does escaping
    },
    react: {
      useSuspense: false, // Disable suspense to avoid issues with SSR
    },
  });

export default i18n;