mirror of
https://github.com/kremalicious/asi-calculator.git
synced 2025-01-05 11:25:08 +01:00
17 lines
322 B
TypeScript
17 lines
322 B
TypeScript
|
'use client'
|
||
|
|
||
|
import { useState, useEffect } from 'react'
|
||
|
|
||
|
export function useLocale() {
|
||
|
const [locale, setLocale] = useState('en-US')
|
||
|
|
||
|
useEffect(() => {
|
||
|
const userLocale = navigator?.languages?.length
|
||
|
? navigator.languages[0]
|
||
|
: navigator.language
|
||
|
setLocale(userLocale)
|
||
|
}, [])
|
||
|
|
||
|
return locale
|
||
|
}
|