@UiThread
public final class LocalizationPlugin
extends java.lang.Object
matchMapLanguageWithDeviceDefault(boolean acceptFallback) to match the map language with
the one being currently used on the device. Using setMapLanguage(Locale, boolean acceptFallback) and it's
variants, you can also change the maps language at anytime to any of the supported languages.
The plugin uses a fallback logic in case there are missing resources - if there is no available localization for a label, the plugin will use local name, if it's Latin script based, otherwise English. Traditional Chinese falls back to Simplified Chinese before executing before mentioned logic.
The plugin only support Mapbox sources:| Constructor and Description |
|---|
LocalizationPlugin(com.mapbox.mapboxsdk.maps.MapView mapView,
com.mapbox.mapboxsdk.maps.MapboxMap mapboxMap,
com.mapbox.mapboxsdk.maps.Style style)
Public constructor for passing in the required objects.
|
| Modifier and Type | Method and Description |
|---|---|
void |
matchMapLanguageWithDeviceDefault()
Initializing this class and then calling this method oftentimes will be the only thing you'll
need to quickly adjust the map language to the devices specified language.
|
void |
matchMapLanguageWithDeviceDefault(boolean acceptFallback)
Initializing this class and then calling this method oftentimes will be the only thing you'll
need to quickly adjust the map language to the devices specified language.
|
void |
setCameraToLocaleCountry(int padding)
Adjust the map's camera position so that the entire countries boarders are within the viewport.
|
void |
setCameraToLocaleCountry(java.util.Locale locale,
int padding)
If you'd like to manually set the camera position to a specific map region or country, pass in
the locale (which must have a paired }
MapLocale) to work properly |
void |
setCameraToLocaleCountry(MapLocale mapLocale,
int padding)
You can pass in a
MapLocale directly into this method which uses the country bounds
defined in it to represent the language found on the map. |
void |
setMapLanguage(java.util.Locale locale)
If you'd like to set the map language to a specific locale, you can pass it in as a parameter
and MapLocale will try matching the information with one of the MapLocales found in its map.
|
void |
setMapLanguage(java.util.Locale locale,
boolean acceptFallback)
If you'd like to set the map language to a specific locale, you can pass it in as a parameter
and MapLocale will try matching the information with one of the MapLocales found in its map.
|
void |
setMapLanguage(MapLocale mapLocale)
You can pass in a
MapLocale directly into this method which uses the language defined
in it to represent the language found on the map. |
void |
setMapLanguage(java.lang.String language)
Set the map language directly by using one of the supported map languages found in
MapLocale.Languages. |
public LocalizationPlugin(@NonNull
com.mapbox.mapboxsdk.maps.MapView mapView,
@NonNull
com.mapbox.mapboxsdk.maps.MapboxMap mapboxMap,
@NonNull
com.mapbox.mapboxsdk.maps.Style style)
mapView - the MapView object in which the map is displayedmapboxMap - the Mapbox map object which your current map view is using for controlstyle - the Style object that represents a fully loaded stylepublic void matchMapLanguageWithDeviceDefault()
public void matchMapLanguageWithDeviceDefault(boolean acceptFallback)
acceptFallback - whether the locale should fallback to the first declared that matches the language,
the fallback locale can be added with MapLocale.addMapLocale(Locale, MapLocale)public void setMapLanguage(java.lang.String language)
MapLocale.Languages.language - one of the support languages Mapbox usespublic void setMapLanguage(@NonNull
java.util.Locale locale)
MapLocale for it.locale - a Locale which has a complementary MapLocale for itpublic void setMapLanguage(@NonNull
java.util.Locale locale,
boolean acceptFallback)
MapLocale for it.locale - a Locale which has a complementary MapLocale for itacceptFallback - whether the locale should fallback to the first declared that matches the language,
the fallback locale can be added with MapLocale.addMapLocale(Locale, MapLocale)public void setMapLanguage(@NonNull
MapLocale mapLocale)
MapLocale directly into this method which uses the language defined
in it to represent the language found on the map.mapLocale - the MapLocale object which contains the desired map languagepublic void setCameraToLocaleCountry(int padding)
MapLocale matches.padding - camera paddingpublic void setCameraToLocaleCountry(java.util.Locale locale,
int padding)
MapLocale) to work properlylocale - a Locale which has a complementary MapLocale for itpadding - camera paddingpublic void setCameraToLocaleCountry(MapLocale mapLocale, int padding)
MapLocale directly into this method which uses the country bounds
defined in it to represent the language found on the map.mapLocale - the MapLocale object which contains the desired map boundspadding - camera padding