Skip to content

Commit

Permalink
fix bug that Application::getCurrentLanguageCode on ios and mac alway…
Browse files Browse the repository at this point in the history
…s return empty string
  • Loading branch information
xuxiaocheng committed Oct 13, 2014
1 parent d97bc19 commit ff04b44
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cocos/2d/platform/ios/CCApplication.mm
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ of this software and associated documentation files (the "Software"), to deal
// get the current language code.(such as English is "en", Chinese is "zh" and so on)
NSDictionary* temp = [NSLocale componentsFromLocaleIdentifier:currentLanguage];
NSString * languageCode = [temp objectForKey:NSLocaleLanguageCode];
[languageCode getCString:code maxLength:2 encoding:NSASCIIStringEncoding];
[languageCode getCString:code maxLength:3 encoding:NSASCIIStringEncoding];
code[2]='\0';
return code;
}
Expand Down
2 changes: 1 addition & 1 deletion cocos/2d/platform/mac/CCApplication.mm
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ static long getCurrentMillSecond()
// get the current language code.(such as English is "en", Chinese is "zh" and so on)
NSDictionary* temp = [NSLocale componentsFromLocaleIdentifier:currentLanguage];
NSString * languageCode = [temp objectForKey:NSLocaleLanguageCode];
[languageCode getCString:code maxLength:2 encoding:NSASCIIStringEncoding];
[languageCode getCString:code maxLength:3 encoding:NSASCIIStringEncoding];
code[2]='\0';
return code;
}
Expand Down

0 comments on commit ff04b44

Please sign in to comment.