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
- (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) | |
} |
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
- (CPString)bundleLocaleWithUserLanguage:(CPString)aUserLanguage | |
{ | |
var defaultLocale = [self objectForInfoDictionaryKey:@"CPBundleDevelopmentRegion"]; | |
var availableLocales = [self objectForInfoDictionaryKey:@"CPBundleLocalizedResourceKeys"]; | |
var bestMatch, myLocale= nil; | |
UserLanguage = aUserLanguage; | |
// First try matching against the UserLanguage | |
if (UserLanguage && [UserLanguage length]) |
OlderNewer