useNavigatorLanguage
Get the preferred language set by the user in browser settings
The useNavigatorLanguage
hook is helpful when you want to get a reactive value which denotes the language set by the user in their browser settings.
It returned a string
representing the language as defined in RFC:5646 code.
useNavigatorLanguage
Preferred Language is : en-US
Try changing the language settings from hereUsage
Import the hook from @abhushanaj/react-hooks
and use in required component;
API Reference
Parameters
Parameter | Type | Description | Default |
---|---|---|---|
defaultLang | string (optional) | The default language to use on server snapshots while SSR. | en-US |
Return Value
Parameter | Type | Description | Default |
---|---|---|---|
language | string | Language as defined in RFC:5646. | N/A |