export default {
  data() {
    return {
      languages: [],
      activeLang:null,
      displayLanguage: ['en','bo','zh_Hans','ug'],
      languageDisplayName: {
        "ar": "العربية",
        "bn": "বাংলা",
        "bo": "བོད་ཡིག",
        "de": "Deutsch",
        "en": "English",
        "es_419": "Español (Latinoamérica)",
        "es_CU": "Español (Cuba)",
        "es": "Español",
        "fa_AF": "دری",
        "fa": "فارسی",
        "fi": "suomi",
        "fr": "français",
        "ga": "Gaeilge",
        "it": "italiano",
        "km": "ខ្មែរ",
        "ku": "Kurdî",
        "lo": "ລາວ",
        "my": "မြန်မာ",
        "nb_NO": "Norsk",
        "ps": "پښتو",
        "pt_BR": "Português (Brasil)",
        "pt_PT": "Português (Portugal)",
        "ro": "Română",
        "ru": "Русский",
        "si": "සිංහල",
        "tr": "Türkçe",
        "ug": "ئۇيغۇرچە",
        "uk": "Українська",
        "zh_Hans": "简体中文"
      }
    }
  },
  methods: {
    getLanguages() {
      return this.languages;
    },
    updateLanguage(lang) {
      this.$i18n.locale = lang;
      this.$store.commit('setLanguage', lang);
    }
  },
  mounted() {
    const context = this
    for (const locale of Object.keys(this.$i18n.messages)) {
      this.languages.push({
        title: this.languageDisplayName[locale],
        text: this.languageDisplayName[locale],
        value: locale,
        display: context.displayLanguage.includes(locale)
      });
    }
  }
}