1 回答
TA貢獻(xiàn)1852條經(jīng)驗(yàn) 獲得超7個(gè)贊
您可以創(chuàng)建一個(gè)數(shù)組,其中數(shù)組中的值是鍵而不是實(shí)際字符串,并且在渲染它們時(shí),您可以實(shí)際翻譯這些
const ResourcesMedia = [
{
title: 'sometitleKey',
description: 'somedescriptionKey',
href: 'somelink'
},
{
title: 'sometitleKey1',
description: 'somedescriptionKey',
href: 'somelink'
}
]
render() {
const {intl: {formatMessage: t}} = this.props;
return ResourcesMedia.map(item => (
<div>
<div>{t(item.title)</div>
<div>{t(item.description)</div>
<div>
))
}
添加回答
舉報(bào)
