I want to get the system default language and system locale.
I have tried the following code snippet to get the system current locale as the following
NSLocale *locale;
locale = [NSLocale systemLocale];
NSString * localLanguage = [locale objectForKey:NSLocaleIdentifier];
NSLog (@"Language : %@", localLanguage);
NSLog(@"System locale Identifier %@",[locale localeIdentifier]);
But nothing is displayed with System locale Identifier.If it is currentlocale it is giving the correct result.Why system locale is not giving any value and how to get system default language not the user preferred language?please help
You can simply use:
NSString* language = [[NSLocale preferredLanguages] objectAtIndex:0];