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 enMovementLinks from '../locales/en/movementLinks.json'; import enTours from '../locales/en/tours.json'; import enUsers from '../locales/en/users.json'; import enAudit from '../locales/en/audit.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'; import ruMovementLinks from '../locales/ru/movementLinks.json'; import ruTours from '../locales/ru/tours.json'; import ruUsers from '../locales/ru/users.json'; import ruAudit from '../locales/ru/audit.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', 'movementLinks', 'tours', 'users', 'audit'], defaultNS: 'common', resources: { en: { common: enCommon, home: enHome, search: enSearch, gallery: enGallery, painting: enPainting, bio: enBio, annotations: enAnnotations, debug: enDebug, translations: enTranslations, influences: enInfluences, movementLinks: enMovementLinks, tours: enTours, users: enUsers, audit: enAudit, }, ru: { common: ruCommon, home: ruHome, search: ruSearch, gallery: ruGallery, painting: ruPainting, bio: ruBio, annotations: ruAnnotations, debug: ruDebug, translations: ruTranslations, influences: ruInfluences, movementLinks: ruMovementLinks, tours: ruTours, users: ruUsers, audit: ruAudit, }, }, interpolation: { escapeValue: false }, }); export default i18n;