我有一个组件,它使用injectIntl
-HOC,并返回一个消息反应,国际反应呈现组件作为占位符FORMATMESSAGE
...
return (
<Message>
{intl.formatMessage({
id: 'page.checkout.hint'
}, {
link: <b>{intl.formatMessage({ id: 'page.checkout.hint.hyperlink' })}</b>
})}
</Message>
)
...
和我的语言文件看起来像这样:
...
"page.checkout.hint": "You're going to be redirected automatically. If nothing happens, please click {link}",
"page.checkout.hint.hyperlink": "here",
...
此结果是:You're going to be redirected automatically. If nothing happens, please click [object Object]
。
如果我用<FormattedMessage id="page.checkout.hint" values={{ link: <b>{intl.formatMessage({ id: 'page.checkout.hint.hyperlink' })}</b> }}>
反而呈现正确。
有没有人有线索?