diff --git a/src/App.js b/src/App.js index fc71bcc..e07cf1f 100644 --- a/src/App.js +++ b/src/App.js @@ -1,27 +1,7 @@ -import i18next from 'i18next'; -import { initReactI18next } from 'react-i18next'; -import Backend from 'i18next-http-backend'; -import LanguageDetector from 'i18next-browser-languagedetector'; import Test from './components/Test'; +import localizationInit from './config/localization'; -i18next - .use(Backend) - .use(LanguageDetector) - .use(initReactI18next) - .init({ - supportedLngs: ['en' /*, 'fr'*/], - fallbackLng: 'en', - debug: false, - // Options for language detector - detection: { - order: ['localStorage', 'sessionStorage', 'cookie', 'htmlTag'], - caches: ['localStorage'], - }, - // react: { useSuspense: false }, - backend: { - loadPath: '/assets/locales/{{lng}}/translation.json', - }, - }); +localizationInit(); function App() { return ( diff --git a/src/config/localization.js b/src/config/localization.js new file mode 100644 index 0000000..d924595 --- /dev/null +++ b/src/config/localization.js @@ -0,0 +1,25 @@ +import i18next from 'i18next'; +import { initReactI18next } from 'react-i18next'; +import Backend from 'i18next-http-backend'; +import LanguageDetector from 'i18next-browser-languagedetector'; + +export default function localizationInit() { + i18next + .use(Backend) + .use(LanguageDetector) + .use(initReactI18next) + .init({ + supportedLngs: ['en' /*, 'fr'*/], + fallbackLng: 'en', + debug: false, + // Options for language detector + detection: { + order: ['localStorage', 'sessionStorage', 'cookie', 'htmlTag'], + caches: ['localStorage'], + }, + // react: { useSuspense: false }, + backend: { + loadPath: '/assets/locales/{{lng}}/translation.json', + }, + }); +} diff --git a/src/config/placeholder b/src/config/placeholder deleted file mode 100644 index e69de29..0000000