【发布时间】:2019-07-26 19:14:38
【问题描述】:
以前我使用react-intl 并且能够为将替换为组件的项目设置占位符,例如{br} 和 <br />。
我目前在尝试使用 react-i18next 和 i18next-icu 时遇到错误:
// Using Intl format (via i18next-icu)
{
"test": "Replace with a{br}line-break. {button}"
}
t("test", { br: <br />, button: <button>Click me!</button> });
// Outputted translated text
Replace with a[object Object]line-break. [object Object]
真的可以使用 i18next/i18next-icu 来做到这一点吗?如果不是,将组件插入已翻译字符串的另一种方法是什么?
【问题讨论】:
标签: reactjs i18next react-intl react-i18next