【问题标题】:Translation probem with i18nexti18next 的翻译问题
【发布时间】:2021-06-26 08:40:59
【问题描述】:

我正在使用 i18next 从包含所有语言的单个文件切换到每种语言的一个文件。

这是translation.json 文件

{
    "section":{
        "title":"wello world"
    }
}

这是home.js的导出

export default withTranslation('translation')(Home);

这是 i18next.init 的后端部分

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

文本是否可以使用t('title') 而不是t('section.title')

我无法更改translation.json

【问题讨论】:

  • I18next 不支持该功能。

标签: reactjs next.js i18next


【解决方案1】:

这不是直接可以的,但是i18next-http-backend有一个解析函数:https://github.com/i18next/i18next-http-backend#backend-options

也许您可以尝试操纵数据以满足您的需求。

【讨论】:

    猜你喜欢
    • 2012-10-27
    • 2015-12-27
    • 2012-10-11
    • 1970-01-01
    • 2015-11-04
    • 1970-01-01
    • 1970-01-01
    • 2021-08-14
    • 1970-01-01
    相关资源
    最近更新 更多