<template>
  <router-view />
</template>

<script setup lang="ts">
import { watch } from 'vue';
import { useI18n } from 'vue-i18n';

import { resolveI18nLocale, usePreferencesStore } from 'src/stores/preferences-store';

const { locale } = useI18n();
const preferencesStore = usePreferencesStore();

watch(
  () => preferencesStore.language,
  (language) => {
    locale.value = resolveI18nLocale(language);
  },
  { immediate: true },
);
</script>
