Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
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

Open

Description

@1ec5

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

Activity

  1. added
    iOS
    macOS
    localization
    Google Maps parity
    on Aug 25, 2018
  2. added
    archived
    on Feb 21, 2019
  3. stale commented on Feb 21, 2019

    @stale

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

  4. removed
    archived
    on Feb 21, 2019
  5. added
    archived
    on Aug 20, 2019
  6. stale commented on Aug 20, 2019

    @stale

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

  7. removed
    archived
    on Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Google Maps paritybuggl-iosiOSlocalizationmacOSruntime styling

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions