Skip to content

Commit

Permalink
zh-HK处理
Browse files Browse the repository at this point in the history
zh-HK处理
  • Loading branch information
520dev committed Jun 15, 2016
1 parent ada9e24 commit 4678b48
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion MJRefresh.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'MJRefresh'
s.version = '3.1.5'
s.version = '3.1.6'
s.summary = 'An easy way to use pull-to-refresh'
s.homepage = 'https://github.com/CoderMJLee/MJRefresh'
s.license = 'MIT'
Expand Down
6 changes: 5 additions & 1 deletion MJRefresh/Base/MJRefreshComponent.m
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,18 @@ - (NSString *)localizedStringForKey:(NSString *)key withDefault:(NSString *)defa
if (bundle == nil) {
// 获得设备的语言
NSString *language = [NSLocale preferredLanguages].firstObject;
// 如果是iOS9以上,截取前面的语言标识
// 如果是iOS9以上,去掉后面的设备购买地区比如zh-Hans-US和zh-Hans-CN后面的US和CN
if ([UIDevice currentDevice].systemVersion.floatValue >= 9.0) {
NSRange range = [language rangeOfString:@"-" options:NSBackwardsSearch];
if (range.location != NSNotFound) {
language = [language substringToIndex:range.location];
}
}

if ([language isEqualToString:@"zh"]) { // zh-HK被去掉了-HK
language = @"zh-Hant";
}

if (language.length == 0) {
language = @"zh-Hans";
}
Expand Down

0 comments on commit 4678b48

Please sign in to comment.