Files

8 lines
326 B
TypeScript
Raw Permalink Normal View History

import type { Locale } from '#shared/utils/locale'
/** Derives the current locale from the URL path — `/en` or `/en/...` is English, everything else Italian. */
export function useLocale() {
const route = useRoute()
return computed<Locale>(() => (route.path === '/en' || route.path.startsWith('/en/') ? 'en' : 'it'))
}