+ (NSString *)getLanguage {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSArray *allLanguages = [defaults objectForKey:@"AppleLanguages"];
NSString *preferredLang = [allLanguages objectAtIndex:0];
return preferredLang;
}
+ (BOOL)languageIsChinese {
BOOL isChinese = NO;
NSString *language = [self getLanguage];
if ([language rangeOfString:@"zh-Hans"].location != NSNotFound ||
[language rangeOfString:@"zh-Hant"].location != NSNotFound ||
[language rangeOfString:@"zh-TW"].location != NSNotFound ||
[language rangeOfString:@"zh-HK"].location != NSNotFound)
isChinese = YES;
return isChinese;
}
网友评论