【发布时间】:2022-01-02 19:34:15
【问题描述】:
我正在尝试创建一个位于翻译字符串中间的变量,但我找不到解决方案。 我需要两种不同语言的所有翻译:“en”和“de”
我的代码如下所示:
import { useTranslation } from 'react-i18next'
const { t } = useTranslation('payment');
const companyName = 'Probando'
<Typography>{ t('setup with company name', <b>{companyName: companyName}</b>)</Typography>
我的翻译文件:
支付 en.json
{ "setup with company name": "Please contact {{ companyName }} to re-edit or re-send this invitation.", }
付款de.json:
{ "setup with company name": "Bitte wenden Sie sich an {{ companyName }} um diese Einladung nochmal zu bearbeiten oder neu zu erhalten." }
【问题讨论】:
标签: javascript reactjs translation react-i18next