From e2d659e859b0719af9e0325a773eefcd312b1061 Mon Sep 17 00:00:00 2001 From: nazar-kutz Date: Thu, 22 Apr 2021 18:43:37 +0300 Subject: [PATCH] Fix #11423 Wikipedia labels on the map shown on few languages --- .../osmand/plus/views/layers/POIMapLayer.java | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/views/layers/POIMapLayer.java b/OsmAnd/src/net/osmand/plus/views/layers/POIMapLayer.java index 1adeed7671..49e5d49a56 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/POIMapLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/POIMapLayer.java @@ -357,19 +357,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon @Override public PointDescription getObjectName(Object o) { if (o instanceof Amenity) { - Amenity amenity = (Amenity) o; - String preferredLang = app.getSettings().MAP_PREFERRED_LOCALE.get(); - boolean transliterateNames = app.getSettings().MAP_TRANSLITERATE_NAMES.get(); - - if (amenity.getType().isWiki()) { - if (Algorithms.isEmpty(preferredLang)) { - preferredLang = app.getLanguage(); - } - preferredLang = OsmandPlugin.onGetMapObjectsLocale(amenity, preferredLang); - } - - return new PointDescription(PointDescription.POINT_TYPE_POI, - amenity.getName(preferredLang, transliterateNames)); + return new PointDescription(PointDescription.POINT_TYPE_POI, getAmenityName((Amenity) o)); } return null; } @@ -431,8 +419,20 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon @Override public String getText(Amenity o) { - return o.getName(view.getSettings().MAP_PREFERRED_LOCALE.get(), - view.getSettings().MAP_TRANSLITERATE_NAMES.get()); + return getAmenityName(o); + } + + private String getAmenityName(Amenity amenity) { + String locale = app.getSettings().MAP_PREFERRED_LOCALE.get(); + + if (amenity.getType().isWiki()) { + if (Algorithms.isEmpty(locale)) { + locale = app.getLanguage(); + } + locale = OsmandPlugin.onGetMapObjectsLocale(amenity, locale); + } + + return amenity.getName(locale, app.getSettings().MAP_TRANSLITERATE_NAMES.get()); } @Override