如何将参数传递给翻译

How to pass parameters to translations

我在 TS 中使用 vuejs 3。

我在 TS 中创建的翻译文件是这样的:

index.ts:

export default {
 'example': 'example',
}

然后这样使用:

{{ $t('example') }}

现在我想给翻译传递一个参数,例如:

index.ts:

export default {
 'hi_man': 'Hi {name}',    //where the name is the parameter
}

我该怎么做?

也许您应该考虑阅读文档:https://kazupon.github.io/vue-i18n/guide/formatting.html#named-formatting

<p>{{ $t('hi_man', { name: 'Monkey' }) }}</p>