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

import commonTranslationsEN from './locales/en/common.json'
import homeTranslationsEN from './locales/en/home.json'
import peopleTranslationsEN from './locales/en/people.json'
import authTranslationsEN from './locales/en/auth.json'
import sessTranslationsEN from './locales/en/sessions.json'
import unsubscribeTranslationsEN from './locales/en/unsubscribe.json'

import commonTranslationsES from './locales/es/common.json'
import homeTranslationsES from './locales/es/home.json'
import peopleTranslationsES from './locales/es/people.json'
import authTranslationsES from './locales/es/auth.json'
import sessTranslationsES from './locales/es/sessions.json'
import unsubscribeTranslationsES from './locales/es/unsubscribe.json'

i18n.use(initReactI18next).init({
  fallbackLng: 'en',
  lng: 'en',
  resources: {
    en: {
      //translations: require('./locales/en/translations.json')
      common: commonTranslationsEN,
      home: homeTranslationsEN,
      people: peopleTranslationsEN,
      auth: authTranslationsEN,
      sessions: sessTranslationsEN,
      unsubscribe: unsubscribeTranslationsEN,
    },
    es: {
      //translations: require('./locales/es/translations.json')
      common: commonTranslationsES,
      home: homeTranslationsES,
      people: peopleTranslationsES,
      auth: authTranslationsES,
      sessions: sessTranslationsES,
      unsubscribe: unsubscribeTranslationsES,
    }
  },
  //ns: ['translations'],
  defaultNS: 'common'
});

i18n.languages = ['en', 'es'];

export default i18n;