Is possible to extend vue-i18n to get random translation from array ?
plcdnl opened this issue · 1 comments
plcdnl commented
Clear and concise description of the problem
I would to know if is possilbe to extend the module like in this case: i18next/i18next#1070
Suggested solution
i think that the 18next solution can be useful also for vue
Alternative
No response
Additional context
No response
Validations
- Read the Contributing Guidelines
- Read the Documentation
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
spengjie commented
Your request is easy to implement by using Message Function. Please see my sample code below.
messages = {
random: () => {
const list = ['Hi', 'Hello'];
return list[Math.floor(Math.random() * list.length)];
}
}
<span>{{ $t('random') }}</span>