Skip to content

Instantly share code, notes, and snippets.

@jgillich
Created January 19, 2015 14:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jgillich/e55cfb283acae0f4eb45 to your computer and use it in GitHub Desktop.
Save jgillich/e55cfb283acae0f4eb45 to your computer and use it in GitHub Desktop.
var locales = {
en: {
hello: 'Hello'
},
de: {
hello: 'Hallo'
}
};
var userLanguage = navigator.language.split('-')[0];
var currentLocale = locales[userLanguage] || locales['en'];
console.log(currentLocale.hello);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment