admin管理员组文章数量:1316371
I am using Vue3 with vue-i18n to translate the page to several languages.
let's say I have the following setup :
messages: {
"en": {
"title": "Hello @:name",
"subtitle": "How are you @:name?",
"name": "Roger",
},
"nl": {
"title": "Hello @:name",
"subtitle": "How are you @:name?",
"name": "Roger",
}
}
The linking inside the messages that I am doing, works according to the documentation when we leave a space after the link. Otherwise we get an error, because i18n thinks the character after the link is a part of the link.
I have tried working with brakets, but nothing seems to work. And I really don't like the way it looks with a whitespace after the name.
Any help will be appreciated.
I tried placing brakets :
"How are you (@:name)?" "How are you @:(name)?"
But this doesn't work.
I am using Vue3 with vue-i18n to translate the page to several languages.
let's say I have the following setup :
messages: {
"en": {
"title": "Hello @:name",
"subtitle": "How are you @:name?",
"name": "Roger",
},
"nl": {
"title": "Hello @:name",
"subtitle": "How are you @:name?",
"name": "Roger",
}
}
The linking inside the messages that I am doing, works according to the documentation when we leave a space after the link. Otherwise we get an error, because i18n thinks the character after the link is a part of the link.
I have tried working with brakets, but nothing seems to work. And I really don't like the way it looks with a whitespace after the name.
Any help will be appreciated.
I tried placing brakets :
"How are you (@:name)?" "How are you @:(name)?"
But this doesn't work.
Share Improve this question edited Jan 29 at 11:24 Estus Flask 223k79 gold badges472 silver badges610 bronze badges asked Jan 29 at 10:23 TriestTriest 687 bronze badges1 Answer
Reset to default 1A workaround used in the documentation is to add space:
"subtitle": "How are you @:name ?"
These are braces and not parentheses that are used in vue-i18n message syntax. It could be assumed they can be used as delimiters for tokens that contain whitespace, which are common. This is not documented but can be seen in tests, so it would be:
"subtitle": "How are you @:{'name'}?"
本文标签: vuejsLinking inside a i18n message (vue3)Stack Overflow
版权声明:本文标题:vue.js - Linking inside a i18n message (vue3) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742003526a2411497.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论