Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/core/usePreferredLanguages/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Ref } from 'vue'
import type { ShallowRef } from 'vue'
import type { ConfigurableWindow } from '../_configurable'
import { ref as deepRef } from 'vue'
import { shallowRef } from 'vue'
import { defaultWindow } from '../_configurable'
import { useEventListener } from '../useEventListener'

Expand All @@ -12,13 +12,13 @@ import { useEventListener } from '../useEventListener'
*
* @__NO_SIDE_EFFECTS__
*/
export function usePreferredLanguages(options: ConfigurableWindow = {}): Ref<readonly string[]> {
export function usePreferredLanguages(options: ConfigurableWindow = {}): ShallowRef<readonly string[]> {
const { window = defaultWindow } = options
if (!window)
return deepRef(['en'])
return shallowRef(['en'])

const navigator = window.navigator
const value = deepRef<readonly string[]>(navigator.languages)
const value = shallowRef<readonly string[]>(navigator.languages)

useEventListener(window, 'languagechange', () => {
value.value = navigator.languages
Expand Down