diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2018-04-16 15:24:33 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-16 15:24:33 -0700 |
commit | e16ce7d87954e86542e5ef142dbd3aa2e7bc30e4 (patch) | |
tree | 2bbb764024ea4bb9f4121ba3356b6ae19622a4e4 /platform/darwin/src/MGLFillStyleLayer.mm | |
parent | 62dd097328c1776cd62208baf6e46b1cd4154a52 (diff) | |
download | qtlocation-mapboxgl-e16ce7d87954e86542e5ef142dbd3aa2e7bc30e4.tar.gz |
Localize expressions more thoroughly (#11651)
* [ios] Removed changelog entry for Terrarium
The broader feature is new to v4.0.0 as well.
* [ios, macos] Localize expressions more thoroughly
Replaced the MGLStyle.localizesLabels property with a -localizeLabelsIntoLocale: method that allows the caller to specify the locale to localize into. Also exposed a per-expression localization method for developers who want to vary behavior from layer to layer.
* [macos] Offer English labels if preferred language is unsupported
* [ios, macos] Removed dead code
* [ios] Use new localization method in iosapp
* [ios, macos] Fixed local name labels
* [ios, macos] Convert tokens to key path expressions in stop dictionaries
* [ios, macos] Streamlined token upgrading
Separated token upgrading into a separate process that only happens as part of the MGLSymbolStyleLayer.text and MGLSymbolStyleLayer.iconImageName properties’ getters, so that it’s easy to remove later when mbgl changes obviate this workaround. Removed the replacesTokens parameter to the expression localization methods.
* [ios, macos] Preserve whitespace between tokens
* [ios, macos] Moved token replacement to a consistent category
Fixed a build warning.
* [ios, macos] Replace tokens in all string-typed getters
For consistency, replace tokens with key paths in all string-typed style paint and layout properties.
* [ios, macos] Test token replacement
Added tests for replacement of tokens with key paths in expressions. Fixed token replacement for raw strings in stop dictionaries. Avoid sticking a single string inside an mgl_join: call.
* [ios, macos] Test token replacement, localization
Added unit tests of token replacement and localization of expressions. Only NSExpression is responsible for resolving the preferred language now, since NSLocale tends to tack a region code onto the locale identifier and the NSExpression method can be called independently anyways. Added a private variation of +[MGLVectorTileSource preferredMapboxStreetsLanguage] that takes an array of preferred languages. Fixed localization of non-expressions in stop dictionaries.
* [ios, macos] Dictionary keys aren’t necessarily zoom levels
Diffstat (limited to 'platform/darwin/src/MGLFillStyleLayer.mm')
-rw-r--r-- | platform/darwin/src/MGLFillStyleLayer.mm | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/platform/darwin/src/MGLFillStyleLayer.mm b/platform/darwin/src/MGLFillStyleLayer.mm index ab28b414b5..c975e28d6b 100644 --- a/platform/darwin/src/MGLFillStyleLayer.mm +++ b/platform/darwin/src/MGLFillStyleLayer.mm @@ -220,7 +220,8 @@ namespace mbgl { if (propertyValue.isUndefined()) { propertyValue = self.rawLayer->getDefaultFillPattern(); } - return MGLStyleValueTransformer<std::string, NSString *>().toExpression(propertyValue); + NSExpression *expression = MGLStyleValueTransformer<std::string, NSString *>().toExpression(propertyValue); + return expression.mgl_expressionByReplacingTokensWithKeyPaths; } - (void)setFillPatternTransition:(MGLTransition )transition { |