diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java index f697c1a403..17336f769e 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/controllers/AmenityMenuController.java @@ -13,6 +13,7 @@ import net.osmand.osm.PoiCategory; import net.osmand.osm.PoiFilter; import net.osmand.osm.PoiType; import net.osmand.plus.MapMarkersHelper.MapMarker; +import net.osmand.plus.OsmandApplication; import net.osmand.plus.R; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.mapcontextmenu.MenuBuilder; @@ -21,6 +22,7 @@ import net.osmand.plus.mapcontextmenu.builders.AmenityMenuBuilder; import net.osmand.plus.render.RenderingIcons; import net.osmand.plus.transport.TransportStopRoute; import net.osmand.plus.wikipedia.WikipediaDialogFragment; +import net.osmand.plus.wikipedia.WikipediaPoiMenu; import net.osmand.util.Algorithms; import net.osmand.util.OpeningHoursParser; @@ -156,9 +158,16 @@ public class AmenityMenuController extends MenuController { @NonNull @Override public String getNameStr() { - String name = amenity.getName( - amenity.getType().isWiki() ? getPreferredMapAppLang() : getPreferredMapLang(), - isTransliterateNames()); + String preferredLang = getPreferredMapLang(); + if (amenity.getType().isWiki()) { + MapActivity mapActivity = getMapActivity(); + if (mapActivity != null) { + OsmandApplication app = mapActivity.getMyApplication(); + preferredLang = WikipediaPoiMenu.getWikiArticleLanguage(app, + amenity.getSupportedContentLocales(), getPreferredMapAppLang()); + } + } + String name = amenity.getName(preferredLang, isTransliterateNames()); Map additionalInfo = amenity.getAdditionalInfo(); if (additionalInfo != null) { String ref = additionalInfo.get("ref"); diff --git a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java index ff6cc4e7b1..04eade58e2 100644 --- a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java @@ -43,6 +43,7 @@ import net.osmand.plus.render.RenderingIcons; import net.osmand.plus.routing.IRouteInformationListener; import net.osmand.plus.routing.RoutingHelper; import net.osmand.plus.views.MapTextLayer.MapTextProvider; +import net.osmand.plus.wikipedia.WikipediaPoiMenu; import net.osmand.util.Algorithms; import java.util.ArrayList; @@ -354,16 +355,19 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon public PointDescription getObjectName(Object o) { if (o instanceof Amenity) { Amenity a = (Amenity) o; - String preferredMapLang = app.getSettings().MAP_PREFERRED_LOCALE.get(); - String preferredMapAppLang = preferredMapLang; - if (Algorithms.isEmpty(preferredMapAppLang)) { - preferredMapAppLang = app.getLanguage(); - } + String preferredLang = app.getSettings().MAP_PREFERRED_LOCALE.get(); boolean transliterateNames = app.getSettings().MAP_TRANSLITERATE_NAMES.get(); - return new PointDescription(PointDescription.POINT_TYPE_POI, a.getName( - a.getType().isWiki() ? preferredMapAppLang : preferredMapLang, - transliterateNames)); + if (a.getType().isWiki()) { + if (Algorithms.isEmpty(preferredLang)) { + preferredLang = app.getLanguage(); + } + preferredLang = WikipediaPoiMenu.getWikiArticleLanguage(app, + a.getSupportedContentLocales(), preferredLang); + } + + return new PointDescription(PointDescription.POINT_TYPE_POI, + a.getName(preferredLang, transliterateNames)); } return null; }