Disabling i18next XHR backend
This gets the build working until I can figure out the issues between it and react-i18next
This commit is contained in:
parent
274fdf038d
commit
b5cde63e4e
43
src/i18n.js
43
src/i18n.js
@ -1,6 +1,9 @@
|
|||||||
import i18n from 'i18next';
|
import i18n from 'i18next';
|
||||||
import LanguageDetector from 'i18next-browser-languagedetector';
|
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 = [
|
export const locales = [
|
||||||
{ code: 'en', name: 'English' },
|
{ code: 'en', name: 'English' },
|
||||||
@ -9,7 +12,7 @@ export const locales = [
|
|||||||
|
|
||||||
i18n
|
i18n
|
||||||
.use(LanguageDetector)
|
.use(LanguageDetector)
|
||||||
.use(Backend)
|
// .use(Backend)
|
||||||
.init({
|
.init({
|
||||||
fallbackLng: 'en',
|
fallbackLng: 'en',
|
||||||
debug: false,
|
debug: false,
|
||||||
@ -36,23 +39,27 @@ i18n
|
|||||||
interpolation: {
|
interpolation: {
|
||||||
escapeValue: false
|
escapeValue: false
|
||||||
},
|
},
|
||||||
backend: {
|
resources: {
|
||||||
loadPath: '{{lng}}',
|
'en': { translation: en },
|
||||||
parse: data => data,
|
'en-AC': { translation: enAC }
|
||||||
ajax: async (lng, options, callback) => {
|
}
|
||||||
try {
|
// backend: {
|
||||||
const { default: locale } = await import(
|
// loadPath: '{{lng}}',
|
||||||
/* webpackInclude: /\.yaml$/ */
|
// parse: data => data,
|
||||||
/* webpackChunkName: "locale-[index]" */
|
// ajax: async (lng, options, callback) => {
|
||||||
`locales/${ lng }.yaml`);
|
// try {
|
||||||
|
// const { default: locale } = await import(
|
||||||
|
// /* webpackInclude: /\.yaml$/ */
|
||||||
|
// /* webpackChunkName: "locale-[index]" */
|
||||||
|
// `locales/${ lng }.yaml`);
|
||||||
|
|
||||||
callback(locale, { status: '200' });
|
// callback(locale, { status: '200' });
|
||||||
}
|
// }
|
||||||
catch (e) {
|
// catch (e) {
|
||||||
callback(null, { status: '500' });
|
// callback(null, { status: '500' });
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
});
|
});
|
||||||
|
|
||||||
export default i18n;
|
export default i18n;
|
||||||
|
Loading…
Reference in New Issue
Block a user