From b5cde63e4efdd96aafcfec6306e5ad8517ed7320 Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Sat, 23 Mar 2019 18:08:12 -0400 Subject: [PATCH] Disabling i18next XHR backend This gets the build working until I can figure out the issues between it and react-i18next --- src/i18n.js | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/src/i18n.js b/src/i18n.js index f658365..644b083 100644 --- a/src/i18n.js +++ b/src/i18n.js @@ -1,6 +1,9 @@ import i18n from 'i18next'; import LanguageDetector from 'i18next-browser-languagedetector'; -import Backend from 'i18next-xhr-backend'; +// import Backend from 'i18next-xhr-backend'; + +import en from 'locales/en.yaml'; +import enAC from 'locales/en-AC.yaml'; export const locales = [ { code: 'en', name: 'English' }, @@ -9,7 +12,7 @@ export const locales = [ i18n .use(LanguageDetector) - .use(Backend) + // .use(Backend) .init({ fallbackLng: 'en', debug: false, @@ -36,23 +39,27 @@ i18n interpolation: { escapeValue: false }, - backend: { - loadPath: '{{lng}}', - parse: data => data, - ajax: async (lng, options, callback) => { - try { - const { default: locale } = await import( - /* webpackInclude: /\.yaml$/ */ - /* webpackChunkName: "locale-[index]" */ - `locales/${ lng }.yaml`); - - callback(locale, { status: '200' }); - } - catch (e) { - callback(null, { status: '500' }); - } - } + resources: { + 'en': { translation: en }, + 'en-AC': { translation: enAC } } + // backend: { + // loadPath: '{{lng}}', + // parse: data => data, + // ajax: async (lng, options, callback) => { + // try { + // const { default: locale } = await import( + // /* webpackInclude: /\.yaml$/ */ + // /* webpackChunkName: "locale-[index]" */ + // `locales/${ lng }.yaml`); + + // callback(locale, { status: '200' }); + // } + // catch (e) { + // callback(null, { status: '500' }); + // } + // } + // } }); export default i18n;