Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs React Internalization i18n,基于浏览器检测加载json文件_Reactjs_Browser_Localization_Detection - Fatal编程技术网

Reactjs React Internalization i18n,基于浏览器检测加载json文件

Reactjs React Internalization i18n,基于浏览器检测加载json文件,reactjs,browser,localization,detection,Reactjs,Browser,Localization,Detection,我试图只加载特定的浏览器检测语言json文件。但是,我可以在浏览器中看到正在导入所有其他语言的json文件。提前谢谢 import i18n from "i18next"; import detector from "i18next-browser-languagedetector"; import backend from "i18next-xhr-backend"; import { reactI18nextModule } fro

我试图只加载特定的浏览器检测语言json文件。但是,我可以在浏览器中看到正在导入所有其他语言的json文件。提前谢谢

import i18n from "i18next";
import detector from "i18next-browser-languagedetector";
import backend from "i18next-xhr-backend";
import { reactI18nextModule } from "react-i18next";

// translations are already at
// '../public/locales/en/translation.json'
// which is the default for the xhr backend to load from

i18n
  .use(detector)
  .use(backend)
  .use(reactI18nextModule) // passes i18n down to react-i18next
  .init({
    //lng: "en",
    fallbackLng: "en", // use en if detected lng is not available

    keySeparator: false, // we do not use keys in form messages.welcome

    interpolation: {
      escapeValue: false // react already safes from xss
    }
  });

export default i18n;`
提前谢谢

import i18n from "i18next";
import detector from "i18next-browser-languagedetector";
import backend from "i18next-xhr-backend";
import { reactI18nextModule } from "react-i18next";

// translations are already at
// '../public/locales/en/translation.json'
// which is the default for the xhr backend to load from

i18n
  .use(detector)
  .use(backend)
  .use(reactI18nextModule) // passes i18n down to react-i18next
  .init({
    //lng: "en",
    fallbackLng: "en", // use en if detected lng is not available

    keySeparator: false, // we do not use keys in form messages.welcome

    interpolation: {
      escapeValue: false // react already safes from xss
    }
  });

export default i18n;`