fix countrycode
parent
a6bd02e789
commit
6749f2fc82
|
@ -19,16 +19,9 @@
|
|||
[[FATClient sharedClient] registerSyncExtensionApi:self.name handler:^NSDictionary *(FATAppletInfo *appletInfo, id param) {
|
||||
if([self.name isEqualToString:@"getLanguageCodeSync"]){
|
||||
NSDictionary *resultDict = [NSDictionary dictionary];
|
||||
if([PhizLanguageData sharedInstance].languageCode == nil){
|
||||
NSString *languageCode = [[NSLocale preferredLanguages] firstObject];
|
||||
NSString *shortCode = [[NSLocale componentsFromLocaleIdentifier:languageCode] objectForKey:NSLocaleLanguageCode];
|
||||
NSString *countryCode = [NSString stringWithFormat:@"%@", [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode]];
|
||||
resultDict = @{@"languageCode":shortCode,@"countryCode":countryCode};
|
||||
}else{
|
||||
NSString* shortCode = [PhizLanguageData sharedInstance].languageCode;
|
||||
NSString* countryCode = [PhizLanguageData sharedInstance].countryCode;
|
||||
resultDict = @{@"languageCode":shortCode,@"countryCode":countryCode};
|
||||
}
|
||||
NSString* shortCode = [PhizLanguageData sharedInstance].languageCode;
|
||||
NSString* countryCode = [PhizLanguageData sharedInstance].countryCode;
|
||||
resultDict = @{@"languageCode":shortCode,@"countryCode":countryCode};
|
||||
return resultDict;
|
||||
}
|
||||
return @{};
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
sharedInstance = [[self alloc] init];
|
||||
//sharedInstance.languageCode = @"en"; // Set default language code
|
||||
//sharedInstance.countryCode = @"US";
|
||||
sharedInstance.languageCode = @"en"; // Set default language code
|
||||
sharedInstance.countryCode = @"US";
|
||||
});
|
||||
return sharedInstance;
|
||||
}
|
||||
|
|
|
@ -143,7 +143,7 @@ static MopPlugin *_instance;
|
|||
}
|
||||
}
|
||||
else if ([@"updateLanguage" isEqualToString:call.method]) {
|
||||
NSLog(@"updateLanguage");
|
||||
NSLog(@"updateLanguage,");
|
||||
NSString *cCode = call.arguments[@"countryCode"];
|
||||
NSString *cLang = call.arguments[@"languageCode"];
|
||||
[PhizLanguageData sharedInstance].countryCode = cCode;
|
||||
|
|
Loading…
Reference in New Issue