-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Automatically adapt Mapbox Streets–sourced layers for user preferred language #7031
Comments
We should expose an option on MGLStyle that allows the developer to turn automatic localization on and off (for supported sources). I think it should be on by default, for parity with MapKit and the Google Maps SDK, but there definitely needs to be a way to turn the feature off, in case the developer wants a specific language to be displayed. |
Are any estimations when the issue would be fixed? |
This was done in #9582 on the |
@boundsj Could u please provide any estimation when 3.6.2 would be released? |
@evgzor patch releases for v3.6.x are going out every 2 to three weeks so it should be this week or next. |
@boundsj please look: Localization still does not work on iOS for German language. |
Hi @evgzor did you set |
Additionally, this should be done in |
@friedbunny @fabian-guerra on iOS all good but on Android Mapbox 5.1.3 still an issue: |
Hey @evgzor 👋 That feature is not included in the Android binding and the idea to cover that functionality is implementing it as a plugin. That ticket is still opened so in the meantime you could do it manually:
Locale.getDefault().getDisplayLanguage();
Layer mapText = map.getLayer("place-city-lg-n");
mapText.setProperties(textField("{name_ru}")); If you know the language in advance you could directly change label language as shown above ☝️ For further information check Change your map’s label language and the language switch example. Contributions are more than welcome so I encourage you to take a stab at mapbox/mapbox-plugins-android#36 and send a PR fixing it (follow the steps mentioned above) 😛 Thanks Eugene! |
When a user adjusts the Preferred Language Order setting in the Language & Region section of Settings to a language supported by the Mapbox Streets source, any style based on the Mapbox Streets source should automatically adjust by localizing the labels.
MGLMapView can observe
NSCurrentLocaleDidChangeNotification
and respond by obtainingNSLocale.autoupdatingCurrentLocale
, determining theidentifier
s of the sources whoseURL
matchesmapbox://mapbox.mapbox-streets-v*
, and replacing{name*}
tokens in thetextField
of any MGLSymbolStyleLayer whosesourceIdentifier
is one of those source identifiers. We already do something similar in iosapp on demand: #6819.We could also offer a way to extend this feature to arbitrary sources, by allowing the developer to specify which fields in the source correspond to which languages (see also mapbox/DEPRECATED-mapbox-gl#21).
Iterating over all the sources and style layers will require #6097. Discovering whether a source is Mapbox Streets will require #6584. #7030 would rely on a similar mechanism.
/ref #1108
/cc @incanus @pveugen @boundsj @frederoni
The text was updated successfully, but these errors were encountered: