We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
你好, 我觉得系统语言的获取不应该使用[[NSBundle mainBundle] preferredLocalizations], 而应该取[NSLocale preferredLanguages]中第0个, 再判断, 我只想到了用这种不严谨的判断方法: NSString *firstLanguage = [NSLocale preferredLanguages].firstObject; if ([firstLanguage hasPrefix:@"en"]) { return 英语; } if ([firstLanguage hasPrefix:@"zh-Hans"] || //简体 [firstLanguage hasPrefix:@"yue-Hans"] //粤语简体 ) { return 中文简体; } if ([firstLanguage hasPrefix:@"zh-Hant"] || //繁体 [firstLanguage hasPrefix:@"zh-TW"] || //台湾 [firstLanguage hasPrefix:@"zh-HK"] || //香港 [firstLanguage hasPrefix:@"yue-Hant"] //粤语繁体 ) { return 中文繁体; } if ([firstLanguage hasPrefix:@"ja"]) { return 日语; } if ([firstLanguage hasPrefix:@"ko"]) { return 韩语; }
return 其他;
The text was updated successfully, but these errors were encountered:
No branches or pull requests
你好, 我觉得系统语言的获取不应该使用[[NSBundle mainBundle] preferredLocalizations],
而应该取[NSLocale preferredLanguages]中第0个, 再判断, 我只想到了用这种不严谨的判断方法:
NSString *firstLanguage = [NSLocale preferredLanguages].firstObject;
if ([firstLanguage hasPrefix:@"en"]) {
return 英语;
}
if ([firstLanguage hasPrefix:@"zh-Hans"] || //简体
[firstLanguage hasPrefix:@"yue-Hans"] //粤语简体
) {
return 中文简体;
}
if ([firstLanguage hasPrefix:@"zh-Hant"] || //繁体
[firstLanguage hasPrefix:@"zh-TW"] || //台湾
[firstLanguage hasPrefix:@"zh-HK"] || //香港
[firstLanguage hasPrefix:@"yue-Hant"] //粤语繁体
) {
return 中文繁体;
}
if ([firstLanguage hasPrefix:@"ja"]) {
return 日语;
}
if ([firstLanguage hasPrefix:@"ko"]) {
return 韩语;
}
The text was updated successfully, but these errors were encountered: