diff --git a/components/common/HeaderCustom.vue b/components/common/HeaderCustom.vue index e16fdd2..12f46f9 100644 --- a/components/common/HeaderCustom.vue +++ b/components/common/HeaderCustom.vue @@ -111,6 +111,9 @@ onMounted(() => { lang: locale.value, }, }) + } else { + locale.value = "fr"; + localStorage.setItem("language", locale.value); } }); diff --git a/components/common/HeaderMobile.vue b/components/common/HeaderMobile.vue index 8ebe0da..bb47d20 100644 --- a/components/common/HeaderMobile.vue +++ b/components/common/HeaderMobile.vue @@ -170,6 +170,21 @@ onBeforeMount(() => { isReady.value = true; }); +onMounted(() => { + if (localStorage.getItem("language")) { + locale.value = localStorage.getItem("language"); + + useHead({ + htmlAttrs: { + lang: locale.value, + }, + }) + } else { + locale.value = "fr"; + localStorage.setItem("language", locale.value); + } +}); + const props = defineProps({ type: { type: String, diff --git a/pages/apropos.vue b/pages/apropos.vue index 98d8de7..c5e1ce7 100644 --- a/pages/apropos.vue +++ b/pages/apropos.vue @@ -8,7 +8,10 @@ import { useRouter } from "nuxt/app"; const router = useRouter(); onMounted(() => { - router.push(localStorage.getItem("language") + '/apropos'); + router.push( + localStorage.getItem("language") + ? localStorage.getItem("language") + '/apropos' + : '/fr/apropos'); } ); \ No newline at end of file