1.获取当前设备系统语言
NSArray *appLanguages = [[NSUserDefaults standardUserDefaults] objectForKey:@"AppleLanguages"];
NSString *languageName = [appLanguages objectAtIndex:0];
1.2以下也可以
NSArray *languages = [NSLocale preferredLanguages];
NSString *currentLanguage2 = [languages objectAtIndex:0];
Log( @"currentLanguage2:%@,languages:%@" , currentLanguage2,languages);
2.当前程序语言
NSString *currentLanguage = [[NSUserDefaults standardUserDefaults]objectForKey:AppLanguage];
if (!currentLanguage) {
[[NSUserDefaults standardUserDefaults] setObject:@"en" forKey:AppLanguage];
[XHDataTool sharedDataTool].globalLanguage = @"en";
}else{
[XHDataTool sharedDataTool].globalLanguage = currentLanguage;
}