Files
hoppscotch/components/smart/ChangeLanguage.vue
2021-07-05 16:52:15 +00:00

32 lines
846 B
Vue

<template>
<span>
<tippy
ref="language"
tabindex="-1"
trigger="click"
theme="popover"
arrow
:animate-fill="false"
>
<template #trigger>
<TabPrimary
v-tippy="{ theme: 'tooltip' }"
:title="$t('choose_language')"
:label="`${
$i18n.locales.find(({ code }) => code == $i18n.locale).country
} ${$i18n.locales.find(({ code }) => code == $i18n.locale).name}`"
/>
</template>
<SmartItem
v-for="locale in $i18n.locales.filter(
({ code }) => code !== $i18n.locale
)"
:key="locale.code"
:to="switchLocalePath(locale.code).toString()"
:label="`${locale.country} ${locale.name}`"
@click.native="$refs.language.tippy().hide()"
/>
</tippy>
</span>
</template>