Skip to content

usePreferredLanguages ​

Category
Export Size
537 B
Last Changed
6 minutes ago

Reactive Navigator Languages. It provides web developers with information about the user's preferred languages. For example, this may be useful to adjust the language of the user interface based on the user's preferred languages in order to provide better experience.

Demo ​

Preferred Languages:
en

Usage ​

js
import { usePreferredLanguages } from '@vueuse/core'

const languages = usePreferredLanguages()

Component Usage ​

This function also provides a renderless component version via the @vueuse/components package. Learn more about the usage.

vue
<template>
  <UsePreferredLanguages v-slot="{ languages }">
    Preferred Languages: {{ languages }}
  </UsePreferredLanguages>
</template>

Type Declarations ​

typescript
/**
 * Reactive Navigator Languages.
 *
 * @see https://vueuse.org/usePreferredLanguages
 * @param options
 */
export declare function usePreferredLanguages(
  options?: ConfigurableWindow,
): Ref<readonly string[]>

Source ​

Source • Demo • Docs

Contributors ​

Anthony Fu
Antério Vieira
Anthony Fu
vaakian X
wheat
Alex Kozack

Changelog ​

v12.0.0-beta.1 on 11/21/2024
0a9ed - feat!: drop Vue 2 support, optimize bundles and clean up (#4349)
v9.11.0 on 1/17/2023
d5321 - fix(components): mark defineComponent as pure (#2623)

Released under the MIT License.