Created
December 17, 2020 15:11
-
-
Save wesleybliss/8f6eb3a3d264eb0050f91cd9cf8eb1f3 to your computer and use it in GitHub Desktop.
Get locale #js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const getLocale = () => { | |
const locale = (navigator.languages && navigator.languages.length) | |
? navigator.languages[0] | |
: navigator.language | |
return locale || 'en-US' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment