Open menu dropdown
getBrowserLocale
Read the user's browser language tag (e.g. `'fr-FR'`, `'en-US'`) — returns `undefined` on the server.
Usage
ts
import { getBrowserLocale } from '@maz-ui/utils'
const locale = getBrowserLocale() // 'fr-FR' | 'en-US' | … | undefinedAPI
ts
function getBrowserLocale(): string | undefinedReturns navigator.language on the client. On the server (no navigator), returns undefined.
Notes
- For IP-based country detection instead of the browser-declared locale, see
fetchLocaleIp. - The returned tag follows BCP 47.