升级到 react-intl@4 后,我们面临所有已用作 html 标记的 formattedHtmlMessages 的问题。
<FormattedHTMLMessage id={`${page}.legalNotice`} />
我们尝试用 formattedMessage 替换并尝试 values={{...}}
<FormattedMessage id={`${page}.legalNotice`} />
但首先 html 不被视为 html 标签。此外,由于我们在标签(链接)上使用具有不同和未定义数量的“href”甚至不同“目标”的动态翻译,这似乎不是解决方案。
我们的翻译是这样的:
"myPage1.legalNotice" : "By clicking here I accept <a target="_self" title="my specific title" href='first_link.pdf'>LINK1</a>, and <a target="_blank" title="second_title" href='second_link'>LINK2</a> and <a target="_blank" href='third_link' title='third_title'>LINK3</a>."
"myPage2.legalNotice" : "Another Text .. <a target="_blank" href='another_link.pdf'>LINK2</a>."