私はvue-i18n
を使用しています。中間のアンカータグ付きの文章を翻訳する必要があります。明らかに、私は翻訳の中でhtmlの特定のマークアップを保持したいのですが、これをどのように処理するのがベストですか?私が思い付くことができる唯一のソリューションですvue-i18nの翻訳でのhtmlタグのベストプラクティス?
This is a test sentence which cannot
<a href="https://example.com" class="test-class test-another-class">be split</a>
or it will not make sense
:
{
"en": {
"example": "This is a test sentence which cannot {linkOpen}be split{linkClose} or it will not make sense"
}
}
して、コンポーネントテンプレート内
<p v-html="$t('example', {
'linkOpen': `<a href="https://example/com" class="test-class test-another-class">`,
'linkClose: '</a>'
})
"></p>
ない正確にエレガントしかし
は、次の例を考えてみましょう...
編集:私はこれをテストし、実際には動作しません(htmlをparamsに入れることはできません)ので、今は本当にアイデアがありません!