-
-
Save albertoperezf/b66d59cf43ab11c62e46fd497733ca27 to your computer and use it in GitHub Desktop.
Function for Browser Language
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
const getLocale = () => { | |
let browserLanguage = 'en' | |
if (window.navigator && (window.navigator.language || window.navigator.userLanguage)) { | |
browserLanguage = (window.navigator.language || window.navigator.userLanguage).substr(0, 2); | |
} | |
return browserLanguage | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment