diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2018-04-10 21:14:37 -0700 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2018-04-16 14:46:50 -0700 |
commit | e8e188c21cc70529ef7a9f9b39bc8ee9dedabd2e (patch) | |
tree | bb2652a602dfd03c44cbc05d8aaf9f056196cdeb | |
parent | cd1a87550188e757ea3ada18de6b1f29b8e3870f (diff) | |
download | qtlocation-mapboxgl-e8e188c21cc70529ef7a9f9b39bc8ee9dedabd2e.tar.gz |
[ios] Use new localization method in iosapp
-rw-r--r-- | platform/ios/app/MBXViewController.m | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/platform/ios/app/MBXViewController.m b/platform/ios/app/MBXViewController.m index 07d684cd64..0a76f8c0c5 100644 --- a/platform/ios/app/MBXViewController.m +++ b/platform/ios/app/MBXViewController.m @@ -92,7 +92,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { MBXSettingsMiscellaneousShowZoomLevel, MBXSettingsMiscellaneousScrollView, MBXSettingsMiscellaneousToggleTwoMaps, - MBXSettingsMiscellaneousCountryLabels, + MBXSettingsMiscellaneousLocalizeLabels, MBXSettingsMiscellaneousShowSnapshots, MBXSettingsMiscellaneousShouldLimitCameraChanges, MBXSettingsMiscellaneousPrintLogFile, @@ -130,7 +130,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { @property (nonatomic) NSInteger styleIndex; @property (nonatomic) BOOL debugLoggingEnabled; @property (nonatomic) BOOL customUserLocationAnnnotationEnabled; -@property (nonatomic) BOOL usingLocaleBasedCountryLabels; +@property (nonatomic, getter=isLocalizingLabels) BOOL localizingLabels; @property (nonatomic) BOOL reuseQueueStatsEnabled; @property (nonatomic) BOOL showZoomLevelEnabled; @property (nonatomic) BOOL shouldLimitCameraChanges; @@ -139,7 +139,6 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { @interface MGLMapView (MBXViewController) -@property (nonatomic) BOOL usingLocaleBasedCountryLabels; @property (nonatomic) NSDictionary *annotationViewReuseQueueByIdentifier; @end @@ -383,7 +382,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { [NSString stringWithFormat:@"%@ Zoom/Pitch/Direction Label", (_showZoomLevelEnabled ? @"Hide" :@"Show")], @"Embedded Map View", [NSString stringWithFormat:@"%@ Second Map", ([self.view viewWithTag:2] == nil ? @"Show" : @"Hide")], - [NSString stringWithFormat:@"Show Labels in %@", (_usingLocaleBasedCountryLabels ? @"Default Language" : [[NSLocale currentLocale] displayNameForKey:NSLocaleIdentifier value:[self bestLanguageForUser]])], + [NSString stringWithFormat:@"Show Labels in %@", (_localizingLabels ? @"Default Language" : [[NSLocale currentLocale] displayNameForKey:NSLocaleIdentifier value:[self bestLanguageForUser]])], @"Show Snapshots", [NSString stringWithFormat:@"%@ Camera Changes", (_shouldLimitCameraChanges ? @"Unlimit" : @"Limit")], ]]; @@ -574,7 +573,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { case MBXSettingsMiscellaneous: switch (indexPath.row) { - case MBXSettingsMiscellaneousCountryLabels: + case MBXSettingsMiscellaneousLocalizeLabels: [self styleCountryLabelsLanguage]; break; case MBXSettingsMiscellaneousWorldTour: @@ -1400,8 +1399,8 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { -(void)styleCountryLabelsLanguage { - _usingLocaleBasedCountryLabels = !_usingLocaleBasedCountryLabels; - self.mapView.style.localizesLabels = _usingLocaleBasedCountryLabels; + _localizingLabels = !_localizingLabels; + [self.mapView.style localizeLabelsIntoLocale:_localizingLabels ? [NSLocale localeWithLocaleIdentifier:@"mul"] : nil]; } - (void)styleRouteLine @@ -1984,7 +1983,7 @@ typedef NS_ENUM(NSInteger, MBXSettingsMiscellaneousRows) { // Default Mapbox styles use {name_en} as their label language, which means // that a device with an English-language locale is already effectively // using locale-based country labels. - _usingLocaleBasedCountryLabels = [[self bestLanguageForUser] isEqualToString:@"en"]; + _localizingLabels = [[self bestLanguageForUser] isEqualToString:@"en"]; } - (BOOL)mapView:(MGLMapView *)mapView shouldChangeFromCamera:(MGLMapCamera *)oldCamera toCamera:(MGLMapCamera *)newCamera { |