Skip to content

Commit

Permalink
fix(iOS): missing country translation
Browse files Browse the repository at this point in the history
  • Loading branch information
shajz committed Mar 25, 2024
1 parent e001568 commit 3dc4ca5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/ios/GoogleMaps/PluginGeocoder.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,16 @@ - (void)pluginInitialize
{
NSString *identifier = [NSLocale localeIdentifierFromComponents: [NSDictionary dictionaryWithObject: countryCode forKey: NSLocaleCountryCode]];
NSString *country = [[[NSLocale alloc] initWithLocaleIdentifier:currentLanguage] displayNameForKey: NSLocaleIdentifier value: identifier];
[countries addObject: country];
if (country != nil) {
[countries addObject: country];
} else {
NSString *countryFallback = [[[NSLocale alloc] initWithLocaleIdentifier:@"en-US"] displayNameForKey: NSLocaleIdentifier value: identifier];
if (countryFallback != nil) {
[countries addObject: countryFallback];
} else {
[countries addObject: countryCode];
}
}
}

self.codeForCountryDictionary = [[NSDictionary alloc] initWithObjects:countryCodes forKeys:countries];
Expand Down

0 comments on commit 3dc4ca5

Please sign in to comment.