useWebsiteLocale
Creates persistent website-locale state backed by local storage. Whenever the locale changes, the composable updates the root document language through setWebsiteLocale.
Importing
ts
import { useWebsiteLocale } from '@almighty-shogun/common'Usage
ts
import { useWebsiteLocale } from '@almighty-shogun/common'
const { locale, setLocale } = useWebsiteLocale();
setLocale('nl');Returns
locale: Ref<string>
Current website locale.
setLocale(locale: string): void
Updates the locale ref and applies it to the document.
Type signature
ts
declare function useWebsiteLocale(): UseWebsiteLocale;
type UseWebsiteLocale = {
readonly locale: Ref<string>;
setLocale(newLocale: string): void;
};