iOS: How to Get the Device Current Language Setting? iOS: How to Get the Device Current Language Setting? ios ios

iOS: How to Get the Device Current Language Setting?


User preferred languages are stored can be retrieved from locale as array and current language identifier is the first object in that array:

NSString *currentLanguage = [[NSLocale preferredLanguages] objectAtIndex:0];

If you want language in more readable form then use displayNameForKey:value: method of NSLocale:

NSString *langID = [[NSLocale preferredLanguages] objectAtIndex:0];NSString *lang = [[NSLocale currentLocale] displayNameForKey:NSLocaleLanguageCode value:langID];


Try this:

NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];NSArray* arrayLanguages = [userDefaults objectForKey:@"AppleLanguages"];NSString* currentLanguage = [arrayLanguages objectAtIndex:0];


Getting language and region in Swift:

    LF.log("language", NSLocale.preferredLanguages())    LF.log("locale", NSBundle.mainBundle().preferredLocalizations)

In my case I'm getting:

language: '(    "zh-Hans")'locale: '(    en)'


matomo