//获取当前系统语言
+(NSString *)getCurrentLanguage
{
NSArray *languages = [NSLocale preferredLanguages];
if(languages == nil){
return nil;
}else{
if([languages count] == 0){
return nil;
}else{
NSString *currentLanguage = [languages objectAtIndex:0];
// NSLog(@"%@",currentLanguage);
return currentLanguage;
}
}
}
//判断当前是否为中文
+(BOOL)isCurrentLanguageChinese
{
/*
zh-Hans-CN,
zh-Hant-CN,
en-CN,
ko-CN
*/
NSString *currentLanguage = [SunloginCommonTool getCurrentLanguage];
if(currentLanguage == nil){
return NO;
}else if([currentLanguage isEqualToString:@""]){
return NO;
}
// if([currentLanguage isEqualToString:@"zh-Hans-CN"]){
NSRange subStrRange = [currentLanguage rangeOfString:@"zh-Hans"];
if(subStrRange.length >0){
//简体中文
return YES;
}
// else if([currentLanguage isEqualToString:@"zh-Hant-CN"]){
subStrRange = [currentLanguage rangeOfString:@"zh-Hant"];
if(subStrRange.length >0){
//繁体中文
return YES;
}
//其他语言
return NO;
}