import i18n from 'i18next'; import { initReactI18next } from 'react-i18next'; import { readStoredLocale, writeStoredLocale } from '../utils/localeStorage'; import enCommon from '../locales/en/common.json'; import enHome from '../locales/en/home.json'; import enSearch from '../locales/en/search.json'; import enGallery from '../locales/en/gallery.json'; import enPainting from '../locales/en/painting.json'; import enBio from '../locales/en/bio.json'; import enAnnotations from '../locales/en/annotations.json'; import enDebug from '../locales/en/debug.json'; import enTranslations from '../locales/en/translations.json'; import enInfluences from '../locales/en/influences.json'; import ruCommon from '../locales/ru/common.json'; import ruHome from '../locales/ru/home.json'; import ruSearch from '../locales/ru/search.json'; import ruGallery from '../locales/ru/gallery.json'; import ruPainting from '../locales/ru/painting.json'; import ruBio from '../locales/ru/bio.json'; import ruAnnotations from '../locales/ru/annotations.json'; import ruDebug from '../locales/ru/debug.json'; import ruTranslations from '../locales/ru/translations.json'; import ruInfluences from '../locales/ru/influences.json'; const initialLocale = readStoredLocale(); writeStoredLocale(initialLocale); void i18n.use(initReactI18next).init({ lng: initialLocale, fallbackLng: 'en', supportedLngs: ['en', 'ru'], ns: ['common', 'home', 'search', 'gallery', 'painting', 'bio', 'annotations', 'debug', 'translations', 'influences'], defaultNS: 'common', resources: { en: { common: enCommon, home: enHome, search: enSearch, gallery: enGallery, painting: enPainting, bio: enBio, annotations: enAnnotations, debug: enDebug, translations: enTranslations, influences: enInfluences, }, ru: { common: ruCommon, home: ruHome, search: ruSearch, gallery: ruGallery, painting: ruPainting, bio: ruBio, annotations: ruAnnotations, debug: ruDebug, translations: ruTranslations, influences: ruInfluences, }, }, interpolation: { escapeValue: false }, }); export default i18n;