Composables
useSwitchLocalePath
The useSwitchLocalePath() composable returns a function that allows to switch the locale.
The useSwitchLocalePath()
composable returns a function that allows to switch the locale.
Type
declare function useSwitchLocalePath(options?: I18nCommonRoutingOptionsWithComposable): (locale?: Locale) => string
Usage
<script setup>
const switchLocalePath = useSwitchLocalePath()
</script>
<template>
<NuxtLink :to="switchLocalePath('en')">English</NuxtLink>
<NuxtLink :to="switchLocalePath('fr')">Français</NuxtLink>
</template>