diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2017-09-10 13:13:01 -0700 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2017-11-02 15:19:54 -0700 |
commit | 226033a825bc6b7869c45572568bbd93d9d65055 (patch) | |
tree | 3f03bb0e66b8ea1eca7312b487798664c145ed74 | |
parent | c17011f97a9f0a0a3ca90b858a486862d21657bb (diff) | |
download | qtlocation-mapboxgl-226033a825bc6b7869c45572568bbd93d9d65055.tar.gz |
[ios] Localize accessibility feature names
-rw-r--r-- | platform/ios/src/MGLMapAccessibilityElement.m | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/platform/ios/src/MGLMapAccessibilityElement.m b/platform/ios/src/MGLMapAccessibilityElement.m index 4a4569bb35..b0170a8506 100644 --- a/platform/ios/src/MGLMapAccessibilityElement.m +++ b/platform/ios/src/MGLMapAccessibilityElement.m @@ -1,6 +1,7 @@ #import "MGLMapAccessibilityElement.h" #import "MGLDistanceFormatter.h" #import "MGLFeature.h" +#import "MGLVectorSource+MGLAdditions.h" #import "NSBundle+MGLAdditions.h" @@ -42,8 +43,9 @@ _feature = feature; NSDictionary *attributes = feature.attributes; - // TODO: Localize the name. - self.accessibilityLabel = attributes[@"name"]; + NSString *nameAttribute = [NSString stringWithFormat:@"name_%@", + [MGLVectorSource preferredMapboxStreetsLanguage]]; + self.accessibilityLabel = attributes[nameAttribute]; NSMutableArray *facts = [NSMutableArray array]; @@ -51,7 +53,9 @@ if (attributes[@"type"]) { // FIXME: Unfortunately, these types aren’t a closed set that can be // localized, since they’re based on OpenStreetMap tags. - [facts addObject:[attributes[@"type"] stringByReplacingOccurrencesOfString:@"_" withString:@" "]]; + NSString *type = [attributes[@"type"] stringByReplacingOccurrencesOfString:@"_" + withString:@" "]; + [facts addObject:type]; } // Announce the kind of airport, rail station, or mountain based on its // Maki image name. @@ -68,7 +72,8 @@ } if (facts.count) { - self.accessibilityValue = [facts componentsJoinedByString:NSLocalizedStringWithDefaultValue(@"LIST_SEPARATOR", nil, nil, @", ", @"List separator")]; + NSString *separator = NSLocalizedStringWithDefaultValue(@"LIST_SEPARATOR", nil, nil, @", ", @"List separator"); + self.accessibilityValue = [facts componentsJoinedByString:separator]; } } return self; |