Skip to content
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

Open
1ec5 opened this issue Aug 25, 2018 · 2 comments
Open

Expression localization should avoid making bilingual labels redundant #12738

1ec5 opened this issue Aug 25, 2018 · 2 comments
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

Comments

@1ec5
Copy link
Contributor

1ec5 commented Aug 25, 2018

-[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).

/ref #11867 (comment)
/cc @fabian-guerra @ChrisLoer @nickidlugash

@1ec5 1ec5 added bug iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS runtime styling localization Human language support and internationalization Google Maps parity For feature parity with the Google Maps SDK for Android or iOS labels Aug 25, 2018
@stale stale bot added the archived Archived because of inactivity label Feb 21, 2019
@stale
Copy link

stale bot commented 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 stale bot closed this as completed Feb 21, 2019
@fabian-guerra fabian-guerra reopened this Feb 21, 2019
@stale stale bot removed the archived Archived because of inactivity label Feb 21, 2019
@stale stale bot added the archived Archived because of inactivity label Aug 20, 2019
@stale
Copy link

stale bot commented 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.

@stale stale bot closed this as completed Aug 20, 2019
@fabian-guerra fabian-guerra reopened this Aug 20, 2019
@stale stale bot removed the archived Archived because of inactivity label Aug 20, 2019
@jmkiley jmkiley added the gl-ios label Nov 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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
Projects
None yet
Development

No branches or pull requests

3 participants