Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Apply VueUse composables in Vue 3/Nuxt projects to replace custom implementations with battle-tested utilities.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/useNavigatorLanguage.md
1---2category: Sensors3---45# useNavigatorLanguage67Reactive [navigator.language](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/language).89## Usage1011```ts12import { useNavigatorLanguage } from '@vueuse/core'1314const { language } = useNavigatorLanguage()1516watch(language, () => {17// Listen to the value changing18})19```2021## Type Declarations2223```ts24export interface NavigatorLanguageState extends Supportable {25/**26*27* ISO 639-1 standard Language Code28*29* @info The detected user agent language preference as a language tag30* (which is sometimes referred to as a "locale identifier").31* This consists of a 2-3 letter base language tag that indicates a32* language, optionally followed by additional subtags separated by33* '-'. The most common extra information is the country or region34* variant (like 'en-US' or 'fr-CA').35*36*37* @see https://www.iso.org/iso-639-language-codes.html38* @see https://www.loc.gov/standards/iso639-2/php/code_list.php39*40*/41language: ShallowRef<string | undefined>42}43export interface UseNavigatorLanguageOptions extends ConfigurableWindow {}44export type UseNavigatorLanguageReturn = Readonly<NavigatorLanguageState>45/**46*47* Reactive useNavigatorLanguage48*49* Detects the currently selected user language and returns a reactive language50* @see https://vueuse.org/useNavigatorLanguage51*52* @__NO_SIDE_EFFECTS__53*/54export declare function useNavigatorLanguage(55options?: UseNavigatorLanguageOptions,56): UseNavigatorLanguageReturn57```58