我正在为一个小型网站使用ReactJS。我决定使用i18next来实现国际化,它可以正常工作 - 除非我对翻译关键字使用嵌套引用。
在下面的例子中,intro1和intro2关键字被显示,但welcome.headtitle未被找到(在控制台中出现"missingKey"错误)。
App.js:
...
<p><Trans i18nKey='intro1'/></p>
<p><Trans i18nKey='intro2'/></p>
<p><Trans i18nKey='welcome.headtitle'/></p>
...
翻译.json:
{
"welcome": {
"headtitle": ...
...
},
"intro1": ...,
"intro2": ...,
}
我知道i18next允许嵌套JSON翻译对象。我做错了什么?我已经检查了文档和示例,并没有注意到任何错误。