asi-calculator/features/prices/hooks/use-locale.ts
Matthias Kretschmann 0d08ba807b
better number formatting (#9)
* tweak number display

* select whole amount upon input focus

* handle letter input

* number formatting
2024-04-16 12:20:29 +02:00

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
}