admin管理员组文章数量:1323354
I have developed a react application where I am using i18next, react-i18next, i18next-http-backend for localization.
In my application, I wanted to support only en-us language code for now and maybe will add further languages in the future, so I have added the below settings for i18n configuration.
import i18n from "i18next";
import backend from "i18next-http-backend";
import { initReactI18next } from "react-i18next";
i18n
.use(backend)
.use(initReactI18next)
.init({
lng: "en-us",
fallbackLng: "en-us",
debug: true,
supportedLngs: ["en-us"],
lowerCaseLng: true,
interpolation: {
escapeValue: false,
formatSeparator: ","
}
});
export default i18n;
and placed the localization translation file at public/locales/en-us/translation.json. I have added supportedLngs because I want my i18next-http-backend should load only supported languages.
When I run the application I am getting a below warning
i18next::languageUtils: rejecting language code not found in supportedLngs: en
As per the document here:
I have also tried to set the nonExplicitSupportedLngs: true but then my translation file is not loaded and I am getting another weird warning as below:
i18next::languageUtils: rejecting language code not found in supportedLngs: en-us
i18next::languageUtils: rejecting language code not found in supportedLngs: en
How I can get away from the warning? am I missing something?
Thanks in Advance
I have developed a react application where I am using i18next, react-i18next, i18next-http-backend for localization.
In my application, I wanted to support only en-us language code for now and maybe will add further languages in the future, so I have added the below settings for i18n configuration.
import i18n from "i18next";
import backend from "i18next-http-backend";
import { initReactI18next } from "react-i18next";
i18n
.use(backend)
.use(initReactI18next)
.init({
lng: "en-us",
fallbackLng: "en-us",
debug: true,
supportedLngs: ["en-us"],
lowerCaseLng: true,
interpolation: {
escapeValue: false,
formatSeparator: ","
}
});
export default i18n;
and placed the localization translation file at public/locales/en-us/translation.json. I have added supportedLngs because I want my i18next-http-backend should load only supported languages.
When I run the application I am getting a below warning
i18next::languageUtils: rejecting language code not found in supportedLngs: en
As per the document here: https://www.i18next./overview/configuration-options
I have also tried to set the nonExplicitSupportedLngs: true but then my translation file is not loaded and I am getting another weird warning as below:
i18next::languageUtils: rejecting language code not found in supportedLngs: en-us
i18next::languageUtils: rejecting language code not found in supportedLngs: en
How I can get away from the warning? am I missing something?
Thanks in Advance
Share Improve this question edited Apr 17, 2021 at 12:45 Nik asked Apr 17, 2021 at 12:21 NikNik 1,7771 gold badge20 silver badges39 bronze badges1 Answer
Reset to default 7 +50Try to set the load option to “currentOnly” https://www.i18next./overview/configuration-options#languages-namespaces-resources
本文标签: javascripti18nextlanguageUtils rejecting language code not found in supportedLngs enStack Overflow
版权声明:本文标题:javascript - i18next::languageUtils: rejecting language code not found in supportedLngs: en - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742130150a2422122.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论