CB-4602 geolocation.getPreferredLanguage and geolocation.getLocaleName now return strings with hypen (-) to stay compliant with current standards
diff --git a/src/ios/CDVGlobalization.m b/src/ios/CDVGlobalization.m
index 8a07c8e..8bc53e4 100644
--- a/src/ios/CDVGlobalization.m
+++ b/src/ios/CDVGlobalization.m
@@ -40,6 +40,8 @@
NSString* language = [[NSLocale preferredLanguages] objectAtIndex:0];
if (language) {
+ language = [language stringByReplacingOccurrencesOfString:@"_" withString:@"-"];
+
NSDictionary* dictionary = [NSDictionary dictionaryWithObject:language forKey:@"value"];
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
@@ -63,7 +65,9 @@
NSLocale* locale = [NSLocale currentLocale];
if (locale) {
- dictionary = [NSDictionary dictionaryWithObject:[locale localeIdentifier] forKey:@"value"];
+ NSString *localeIdentifier = [[locale localeIdentifier] stringByReplacingOccurrencesOfString:@"_" withString:@"-"];
+
+ dictionary = [NSDictionary dictionaryWithObject:localeIdentifier forKey:@"value"];
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dictionary];
} else {