How to inject component inside react-i18next translation key using <Trans />?

问题描述 投票:0回答:0

我需要注入一个没有翻译的组件,在带有

next-i18next
的翻译键内,它只代表游戏回合的结果,所以它只是一个样式数字,不需要任何翻译值。

这是组件截图:

我需要的是将这个徽章放在翻译后的字符串中。

按照

<Trans />
提供的
next-i18next
组件文档,我一直在尝试多种不同的方式,但没有成功。

翻译重点:

"test": "Test <0></0> outcome"

反式成分:

<Trans i18nKey="test" t={t}>
  test <SpinNumber bigWin={firstThreeWins[0]} /> outcome
</Trans>

我的预期结果是:

test **styled badge component in the screenshot** outcome

但翻译键不断返回:

[object Object]

有没有什么办法可以将这个组件注入到翻译密钥中?

javascript reactjs internationalization i18next react-i18next
© www.soinside.com 2019 - 2024. All rights reserved.