2021-07-02 05:01:29 +00:00
|
|
|
<template>
|
|
|
|
|
<span>
|
|
|
|
|
<tippy
|
|
|
|
|
ref="language"
|
2021-07-08 07:30:41 +00:00
|
|
|
interactive
|
2021-07-03 13:14:58 +00:00
|
|
|
tabindex="-1"
|
2021-07-02 05:01:29 +00:00
|
|
|
trigger="click"
|
|
|
|
|
theme="popover"
|
|
|
|
|
arrow
|
|
|
|
|
:animate-fill="false"
|
|
|
|
|
>
|
|
|
|
|
<template #trigger>
|
2021-07-19 13:12:33 +00:00
|
|
|
<SmartLink
|
2021-07-03 13:14:58 +00:00
|
|
|
v-tippy="{ theme: 'tooltip' }"
|
|
|
|
|
:title="$t('choose_language')"
|
2021-07-19 13:12:33 +00:00
|
|
|
class="font-medium focus:outline-none"
|
|
|
|
|
>
|
|
|
|
|
{{ `${$i18n.locales.find(({ code }) => code == $i18n.locale).name}` }}
|
|
|
|
|
</SmartLink>
|
2021-07-02 05:01:29 +00:00
|
|
|
</template>
|
2021-07-19 13:12:33 +00:00
|
|
|
<nuxt-link
|
2021-07-13 23:49:08 +00:00
|
|
|
v-for="(locale, index) in $i18n.locales.filter(
|
2021-07-02 05:01:29 +00:00
|
|
|
({ code }) => code !== $i18n.locale
|
|
|
|
|
)"
|
2021-07-13 23:49:08 +00:00
|
|
|
:key="`locale-${index}`"
|
2021-07-19 13:12:33 +00:00
|
|
|
:to="switchLocalePath(locale.code)"
|
|
|
|
|
@click="$refs.language.tippy().hide()"
|
|
|
|
|
>
|
|
|
|
|
<SmartItem
|
|
|
|
|
:label="`${getFlagEmoji(locale.country)} \xA0 ${locale.name}`"
|
|
|
|
|
/>
|
|
|
|
|
</nuxt-link>
|
2021-07-02 05:01:29 +00:00
|
|
|
</tippy>
|
|
|
|
|
</span>
|
|
|
|
|
</template>
|
2021-07-19 13:12:33 +00:00
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
export default {
|
|
|
|
|
methods: {
|
|
|
|
|
getFlagEmoji(c) {
|
|
|
|
|
return String.fromCodePoint(
|
|
|
|
|
...[...c.toUpperCase()].map((x) => 0x1f1a5 + x.charCodeAt())
|
|
|
|
|
)
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
</script>
|