Polyconseil / vue-gettext

Translate your Vue.js applications with gettext.
MIT License
278 stars 55 forks source link

How to translate available languages list? #131

Open 7iomka opened 3 years ago

7iomka commented 3 years ago

Hi. Docs say:

You can use vm.$language.current and vm.$language.available to e.g. easily build a language switch component with a single template:

<template>
  <div>
    <select name="language" v-model="$language.current">
      <option v-for="(language, key) in $language.available" :value="key">{{ language }}</option>
    </select>
  </div>
</template>

My language list is

["English", "Simplified Chinese", "Spanish", "Indonesian", "Portuguese", "Russian", "Japanese", "Hindi", "Vietnamese", "Italian", "Korean", "Thai", "Turkish", "Polish", "Nepali", "Greek", "Serbian"]

I need translation for each of this language to it own language version. For example, for Simplified Chinese

["英语","简体中文","西班牙语","印度尼西亚语","葡萄牙语","俄语","日语","印地语","越南语","意大利语","韩语","泰语", "土耳其语","波兰语","尼泊尔语","希腊语","塞尔维亚语"]

How to do that?

What I tried:

Object.values(this.$language.available).map((lang) =>this.$gettext(lang));

This only produces

#: src/pages/Index.vue:18
msgid "lang"
msgstr ""

Also I'm tried all variants from https://github.com/Polyconseil/vue-gettext#caveat-when-using-either-the-component-translate-or-directive-v-translate-with-interpolation-inside-v-for Nothing not working.

Help me please.