Multi language
Using Mappedin SDK for Android with your own map requires a Pro license. Try a demo map for free or refer to the Pricing page for more information.
Mappedin SDKs have the ability to support multiple languages. The particular languages supported will vary by venue. Each language must be enabled and text translated in the source map before a language can be used in the SDK.
Multi language is currently only supported for enterprise maps created in Mappedin CMS.
EnterpriseVenue.languages will contain an array of supported languages that have been configured in Mappedin CMS for the venue. To get the currently displayed language, use MapData.currentLanguage.
// Get supported languages
mapView.mapData.getByType<EnterpriseVenue>(MapDataType.ENTERPRISE_VENUE) { result ->
result.onSuccess { venues ->
venues.firstOrNull()?.let { venue ->
Log.d("MappedinDemo", "EnterpriseVenue: ${venue.name}")
venue.languages.forEach { lang ->
Log.d("MappedinDemo", "Supported Language: ${lang.name} (${lang.code})")
}
}
}
}
// Get current language
mapView.mapData.currentLanguage { result ->
result.onSuccess { language ->
Log.d("MappedinDemo", "Current language: ${language?.name} (${language?.code})")
}
}
The language can be changed by calling MapData.changeLanguage() and passing in a language code.
mapView.mapData.changeLanguage("es")
Once a change language is complete, a MapData.on(MapDataEvents.LanguageChange) event is fired. At this point the map is ready to use the new language. Use this event to trigger things like re-creation of labels in the new language.
mapView.mapData.on(MapDataEvents.LanguageChange) { payload ->
payload?.let { language ->
Log.d("MapData", "Language changed to ${language.name} (${language.code})")
}
}