kazupon / vue-i18n

:globe_with_meridians: Internationalization plugin for Vue.js

Home Page:https://kazupon.github.io/vue-i18n/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is possible to extend vue-i18n to get random translation from array ?

plcdnl opened this issue · comments

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

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>