This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
Expression localization should avoid making bilingual labels redundant #12738
Labels
bug
gl-ios
Google Maps parity
For feature parity with the Google Maps SDK for Android or iOS
iOS
Mapbox Maps SDK for iOS
localization
Human language support and internationalization
macOS
Mapbox Maps SDK for macOS
runtime styling
-[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)”. Theformat
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
andformat
expressions, as opposed to expressions that serve other purposes, and dealing with them: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).
/ref #11867 (comment)
/cc @fabian-guerra @ChrisLoer @nickidlugash
The text was updated successfully, but these errors were encountered: