HTML标签显示为文本,在i18n翻译中。我该如何修复它?并且'deviceLimit'属性也没有显示。
tsx文件:
const DeviceLimitTooltip: FunctionComponent<Props> = (props) => {
const { classes, deviceLimit, isDeviceLimitReached, children, style } = props;
const [t] = useTranslation();
if (isDeviceLimitReached) {
return (
<Tooltip
title={
<React.Fragment>
{t("devices.freePlan.lastDevice", {deviceLimit: deviceLimit})}
<Link color={'secondary'} href={SUPPORT_CONTACT_US} target={'_blank'}>
{t('devices.freePlan.contactUs')}
</Link>
</React.Fragment>
}
placement="top"
interactive
classes={{ popper: classes.popper, tooltip: classes.tooltip }}
>
<span style={style}>{children}</span>
</Tooltip>
);
}
return <React.Fragment>{children}</React.Fragment>;
};
translation.json:
"freePlan": {
"lastDevice": "You've reached <strong>your limit of {{deviceLimit}} devices</strong> under the current free plan. To add more devices, please, ",
"contactUs": "contact us."
}
这是它现在样子屏幕截图
1条答案
按热度按时间luaexgnf1#
我建议您使用Trans组件:https://react.i18next.com/latest/trans-component
更多信息可以在以下stackoverflow问题中找到:HTML tags in i18next translation files in React