ChangeLanguage.vue 890 B

123456789101112131415161718192021222324252627282930
  1. <template>
  2. <span class="inline-flex">
  3. <tippy ref="language" interactive trigger="click" theme="popover" arrow>
  4. <template #trigger>
  5. <span class="select-wrapper">
  6. <ButtonSecondary
  7. v-tippy="{ theme: 'tooltip' }"
  8. :title="$t('settings.choose_language')"
  9. class="pr-8"
  10. outline
  11. svg="globe"
  12. :label="`${
  13. $i18n.locales.find(({ code }) => code == $i18n.locale).name
  14. }`"
  15. />
  16. </span>
  17. </template>
  18. <NuxtLink
  19. v-for="(locale, index) in $i18n.locales.filter(
  20. ({ code }) => code !== $i18n.locale
  21. )"
  22. :key="`locale-${index}`"
  23. :to="switchLocalePath(locale.code)"
  24. @click="$refs.language.tippy().hide()"
  25. >
  26. <SmartItem :label="locale.name" />
  27. </NuxtLink>
  28. </tippy>
  29. </span>
  30. </template>