mapbox / mapbox-gl-native

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
4.36k stars 1.33k forks source link

Expression localization should avoid making bilingual labels redundant #12738

Open 1ec5 opened 6 years ago

1ec5 commented 6 years ago

-[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:

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 https://github.com/mapbox/mapbox-gl-native/issues/11867#issuecomment-405660217 /cc @fabian-guerra @ChrisLoer @nickidlugash

stale[bot] commented 5 years ago

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[bot] commented 5 years ago

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.