Skip to content

Instantly share code, notes, and snippets.

@theodesp
Created May 29, 2019 12:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theodesp/692364ae0146e5dd23921eb8405f14ae to your computer and use it in GitHub Desktop.
Save theodesp/692364ae0146e5dd23921eb8405f14ae to your computer and use it in GitHub Desktop.
export function detectLocale() {
const languageString = navigator.language || '';
const language = languageString.split(/[_-]/)[0].toLowerCase();
switch (language) {
case 'en':
return 'en';
case 'el':
return 'en';
default:
return 'en';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment