You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Expression localization should avoid making bilingual labels redundant #12738
-[NSExpression(MGLAdditions) mgl_expressionLocalizedIntoLocale:] recurses through the expression tree, aggressively localizing any key path expression it finds. This ensures that even the most sophisticated expressions can be localized. However, a style may intentionally feature bilingual or multilingual labels, in which case this functionality would produce redundant labels. For example, “London (Londres)” might turn into “Londres (Londres)”. The format expression support being added in #12624 is likely to increase the likelihood of bilingual expressions, so it’ll become more important to make the localization functionality more nuanced.
We’ll have to come up with a heuristic for detecting bilingual concat and format expressions, as opposed to expressions that serve other purposes, and dealing with them:
We could either ignore such expressions, figuring that they’re already localized well enough, but in some scenarios, that could leave foreign text in large letters with the user’s own language in relatively small text.
We could localize the first key path expression we encounter and delete the rest.
We could figure out the set of name_* attributes being used in the expression and shuffle them around, but this would require -[NSExpression(MGLAdditions) mgl_expressionLocalizedIntoLocale:] to take additional parameters for context.
It’s worth noting that MapKit doesn’t display bilingual labels at all, while the Google Maps SDK displays localized bilingual labels.
Ultimately, we need something upstream to support localization as a first-class feature that the SDK can simply pass the current locale into. One proposal is for dedicated locale-matching expressions (mapbox/mapbox-gl-js#6197), perhaps streamlined by additions to the TileJSON format (mapbox/tilejson-spec#14) or “style components” in Studio (mapbox/mapbox-gl-js#4225).
Activity
stale commentedon Feb 21, 2019
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.
stale commentedon Aug 20, 2019
This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.