32 lines
686 B
Vue
32 lines
686 B
Vue
|
|
<script setup lang="ts">
|
|
// This Component is Not used any more, as long as I use Buttons to switch between languages.
|
|
const { locales, locale, setLocale } = useI18n()
|
|
|
|
// Langues disponibles sauf celle courante
|
|
const otherLocales = computed(() =>
|
|
locales.value.filter(l => l.code !== locale.value)
|
|
)
|
|
|
|
// Changer la langue
|
|
function changeLocale(locale: 'fr' | 'en') {
|
|
setLocale(locale)
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<button class="panel-item" v-for="l in otherLocales" :key="l.code"
|
|
@click="changeLocale(l.code)"
|
|
>{{ l.name }}</button>
|
|
</template>
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
|
|
|
/* Optional: transition hover pour le select */
|
|
select:hover {
|
|
border-color: #999;
|
|
}
|
|
</style>
|