diff --git a/OsmAnd-java/src/net/osmand/data/Amenity.java b/OsmAnd-java/src/net/osmand/data/Amenity.java index 72ac673e55..d0e62db6fe 100644 --- a/OsmAnd-java/src/net/osmand/data/Amenity.java +++ b/OsmAnd-java/src/net/osmand/data/Amenity.java @@ -157,27 +157,27 @@ public class Amenity extends MapObject { setAdditionalInfo(PHONE, phone); } - public String getNameSelected(String lang, String defLang) { + public String getContentSelected(String tag, String lang, String defLang) { if (lang != null) { - String translateName; - if (lang.equals("en")) { - translateName = getEnName(); - } else { - translateName = getAdditionalInfo("name:" + lang); - } + String translateName = getAdditionalInfo(tag + ":" + lang); if (!Algorithms.isEmpty(translateName)) { return lang; } } - if(!Algorithms.isEmpty(getName())) { + String plainName = getAdditionalInfo(tag); + if (!Algorithms.isEmpty(plainName)) { return defLang; } + String enName = getAdditionalInfo(tag + ":en"); + if (!Algorithms.isEmpty(enName)) { + return enName; + } for (String nm : getAdditionalInfo().keySet()) { if (nm.startsWith("name:")) { return nm.substring("name:".length()); } } - return ""; + return defLang; } public String getName(String lang) { diff --git a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java index abfbea6f47..6302283dc6 100644 --- a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java @@ -382,7 +382,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon topBar.setBackgroundColor(ctx.getResources().getColor(getResIdFromAttribute(ctx, R.attr.pstsTabBackground))); topBar.setTitleTextColor(ctx.getResources().getColor(getResIdFromAttribute(ctx, R.attr.pstsTextColor))); - String lng = a.getNameSelected(lang, "en"); + String lng = a.getContentSelected("content", lang, "en"); if(Algorithms.isEmpty(lng)) { lng = "en"; }