-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[ios, macos] Fix MGLSymbolStyleLayer.text localization issue. #14405
Conversation
We have
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per #14393 (comment), let’s make sure our unit tests cover the cases of localizing both unformatted and formatted expressions. (They can be unit tests, because what’s important is the structure of the resulting expression, not so much the text that comes out of Streets source vector tiles.)
Suggested changelog entry:
- Fixed an issue where the
-[MGLStyle localizeLabelsIntoLocale:]
and-[NSExpression mgl_expressionLocalizedIntoLocale:]
methods had no effect. (#14405)
@@ -1471,6 +1471,12 @@ - (NSExpression *)mgl_expressionLocalizedIntoLocale:(nullable NSLocale *)locale | |||
if (localizedValues != self.constantValue) { | |||
return [NSExpression expressionForConstantValue:localizedValues]; | |||
} | |||
} else if ([self.constantValue isKindOfClass:[MGLAttributedExpression class]]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What’s our theory for how this caused #14393? I was able to reproduce the issue in the standard Streets v10 and v11 styles. Is it because the MGLSymbolStyleLayer.text
setter always returns an attributed expression now, even when the style JSON contains only a constant string value? If so, this may be indicative of a backwards-incompatible change that took place with the introduction of formatted expressions: a developer might reasonably expect to get an ordinary string out of the text
property, just as we apparently did.
|
Will followup with a style localization test. |
45adc40
to
cb4dfd9
Compare
Fixed an MGLSymbolStyleLayer.text localization bug caused by the introduction of MGLAttributedExpression object. The localization parsing was ignoring the latter. * [ios, macos] Fix a localization issue. * [ios, macos] Add formating expressions localization test. * [ios, macos] Update MGLSymbolStyleLayer.text documentation.
Fixed an MGLSymbolStyleLayer.text localization bug caused by the introduction of MGLAttributedExpression object. The localization parsing was ignoring the latter. * [ios, macos] Fix a localization issue. * [ios, macos] Add formating expressions localization test. * [ios, macos] Update MGLSymbolStyleLayer.text documentation.
Fixes #14393 introduced in #14094
Localization was not performed due to the introduction of
MGLAttributedExpression
object. At localization time there was not a proper converter for format expressions, returning the same expression thus avoiding localization.This is how it looks now on iOS
This is how it looks now on macOS