Skip to content

Instantly share code, notes, and snippets.

@j4johnfox
Created July 9, 2010 17:39
Show Gist options
  • Save j4johnfox/469757 to your computer and use it in GitHub Desktop.
Save j4johnfox/469757 to your computer and use it in GitHub Desktop.
- (CPString)browserLanguage
{
// IE uses userLanguage to return the code. For now, we'll just deal with
// the "base" language (e.g. "en" vs. "en-GB"
var userLang = (navigator.language) ? navigator.language : navigator.userLanguage;
return userLang.substring(0,2)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment