i18next Displayed key instead of value

﹥>﹥吖頭↗ 提交于 2019-12-05 16:05:09

You have to set useLocalStorage and useDataAttrOptions to true

$.i18n.init({useLocalStorage: true , useDataAttrOptions:true, ....});

as of i18next V2, the backend is no longer provided out of the box (see the migration guide), so you're required to define a backend configuration in the init block:

backend: {
    loadPath: '/locales/{{lng}}/{{ns}}.json'
},

if you don't do that, your resources will not be loaded, and translation values will fallback to their respective keys (see the source code).

Morgane

In js it's because $(document).ready doesn't wait for external contents to be loaded. You need to use $(window).on('load',function(){...}).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!