假设我有这样的钥匙:
{ key1: "my name is {{name, bold}}" }
我希望有这样的功能:
i18next.init({
interpolation: {
format: function(value, format, lng) {
if (format === 'bold') return <strong>{value}</string>;
return value;
}
}
});
但我收到以下错误:
使用 JSX react/react-in-jsx-scope 时,'React' 必须在范围内
有什么办法可以做到这一点?我真的很想在我的 i18n 占位符中使用插值来进行一些简单的自定义样式。