Skip to content

Localization plugin should transform expressions #374

Closed

Description

@1ec5

The map localization plugin added in #74 only works if a text-field property is set to a constant value that uses the legacy token syntax, e.g. {name_en}. In a style such as Mapbox Streets, some layers’ text-fields are set to camera functions, so they remain unlocalized. To make matters worse, future versions of these and other styles will be written for versions of the SDK that support expressions. {name_en} will become ["get", "name_en"], so this plugin will end up having no effect whatsoever.

/ref mapbox/mapbox-gl-native#10713 mapbox/mapbox-gl-js#6197
/cc @langsmith @tobrun

Activity

  1. added
    bug
    on Mar 19, 2018
  2. cammace commented on Apr 20, 2018

    @cammace

    This issues blocked by a few problems downstream, mainly mapbox/mapbox-gl-native#11659 and mapbox/mapbox-gl-native#11749.

  3. 1ec5 commented on Aug 22, 2018

    @1ec5
    ContributorAuthor

    #455 is a very early start at localizing expressions that has stalled out. Both mapbox/mapbox-gl-native#11659 and mapbox/mapbox-gl-native#11749 have been fixed, so this work is technically unblocked.

    However, in the process of implementing mapbox/mapbox-navigation-android#1226, we discovered another missing piece of the map SDK. There’s no way to determine a layer’s source, only a layer’s source layer: mapbox/mapbox-gl-native#12691. So although it is possible to localize a style, the localization will be very aggressive, affecting all layers, not only the ones backed by the Streets source. For example, if the style contains a symbol layer whose text field is based on a GeoJSON source’s name field, this plugin would potentially localize it to a field that isn’t provided by the GeoJSON source.

    Until mapbox/mapbox-gl-native#12691 is fixed, this plugin will have to take the same approach as mapbox/mapbox-gl-native#12387 of coalescing the localized field with name. That ends up being necessary for fully supporting Chinese anyways.

  4. 1ec5 commented on Oct 31, 2018

    @1ec5
    ContributorAuthor

    Fixed in #654.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

buglocalization-plugin

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions