[英]How to pass parameters to translations
我正在使用帶有 TS 的 vuejs 3。
我在 TS 中創建了這樣的翻譯文件:
索引.ts:
export default {
'example': 'example',
}
為了然后以這種方式使用它:
{{ $t('example') }}
現在我想將一個參數傳遞給翻譯,例如:
索引.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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.