繁体   English   中英

在链接后用文本反应 i18next 反式组件

[英]React i18next trans component with text after link

我有一个简单的 trans 组件,如下所示:

    <Trans
      i18nKey="login_screen:terms_of_use"
      components={{
        privacy_policy: (
          <TouchableOpacity
            onPress={() => {
              void Linking.openURL(
                'https:.....',
              )
            }}
          >
            <Link>{t('privacy_policy')}</Link>
          </TouchableOpacity>
        ),
      }}
    /> 

我想要以下文字:

“Ich stimme die app Dattenschutzbestimmungen zu”,其中链接是 Dattenschutzbestimmungen。

这是我的 json:

"terms_of_use": "Ich stimme die app <privacy_policy><0><0></privacy_policy> zu",
"privacy_policy": "Datenschutzbestimmungen",

使用当前的解决方案,我得到以下文本:Ich stimme die app Datenschutzbestimmungen

有什么帮助吗?

谢谢

尝试以这种方式使用 Trans 组件:

<Trans
  i18nKey="login_screen:terms_of_use"
>
  Ich stimme den app
  <TouchableOpacity
    onPress={() => {
      void Linking.openURL(
        'https:.....',
      )
    }}
  >
    <Link>Dattenschutzbestimmungen</Link>
  </TouchableOpacity>
  zu.
</Trans>

使用此资源:

"terms_of_use": "Ich stimme die app <1><0>Datenschutzbestimmungen</0></1> zu."

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM