vue-i18n
vue-i18n copied to clipboard
Linked messages not working for arrays
Module versions (please complete the following information):
-
vue
: 2.6.0 -
vue-i18n
: 8.25.0
Reproduction Link https://jsfiddle.net/dvLden/z5tqx4mu/5/
Expected behavior https://vue-i18n.intlify.dev/guide/essentials/syntax.html#linked-messages
Array approach should work too with common v-for
iteration?
Am I missing something from the docs? I did not see anywhere in the docs that linked messages are being used in arrays, but it's very much needed for me.
Thank you for your reporting!
Array approach should work too with common v-for iteration?
Unfortunately, linked messages will not be resolved if t
or $t
returns an array with a key.
If you are using it for a repeat such as v-for
, you can use the index to return an array-like in the working case of the reproduction code you provided
You need to use something like "$t('xxxx.${index}`)".