Merge remote-tracking branch 'origin/DoNotSearchPoiAdditional' into DoNotSearchPoiAdditional
# Conflicts: # OsmAnd/src/net/osmand/plus/search/QuickSearchListAdapter.java
This commit is contained in:
commit
a4fce4bb16
3 changed files with 57 additions and 12 deletions
|
@ -19,6 +19,7 @@ public abstract class AbstractPoiType {
|
|||
private String poiAdditionalCategory;
|
||||
private List<String> excludedPoiAdditionalCategories;
|
||||
private String synonyms;
|
||||
private String enSynonyms;
|
||||
private String enTranslation;
|
||||
private String translation;
|
||||
|
||||
|
@ -77,12 +78,19 @@ public abstract class AbstractPoiType {
|
|||
}
|
||||
|
||||
public String getSynonyms() {
|
||||
|
||||
if(synonyms == null) {
|
||||
synonyms = registry.getSynonyms(this);
|
||||
}
|
||||
return synonyms;
|
||||
}
|
||||
|
||||
public String getEnSynonyms() {
|
||||
if(enSynonyms == null) {
|
||||
enSynonyms = registry.getEnSynonyms(this);
|
||||
}
|
||||
return enSynonyms;
|
||||
}
|
||||
|
||||
public String getEnTranslation() {
|
||||
|
||||
if(enTranslation == null) {
|
||||
|
|
|
@ -59,6 +59,9 @@ public class MapPoiTypes {
|
|||
|
||||
String getSynonyms(AbstractPoiType type);
|
||||
String getSynonyms(String keyName);
|
||||
|
||||
String getEnSynonyms(AbstractPoiType type);
|
||||
String getEnSynonyms(String keyName);
|
||||
}
|
||||
|
||||
public static MapPoiTypes getDefaultNoInit() {
|
||||
|
@ -710,6 +713,17 @@ public class MapPoiTypes {
|
|||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getEnSynonyms(AbstractPoiType abstractPoiType) {
|
||||
if (poiTranslator != null) {
|
||||
String translation = poiTranslator.getEnSynonyms(abstractPoiType);
|
||||
if (!Algorithms.isEmpty(translation)) {
|
||||
return translation;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getEnTranslation(AbstractPoiType abstractPoiType) {
|
||||
if (poiTranslator != null) {
|
||||
String translation = poiTranslator.getEnTranslation(abstractPoiType);
|
||||
|
|
|
@ -334,11 +334,10 @@ public class AppInitializer implements IProgress {
|
|||
|
||||
app.poiTypes.setPoiTranslator(new MapPoiTypes.PoiTranslator() {
|
||||
|
||||
|
||||
@Override
|
||||
public String getTranslation(AbstractPoiType type) {
|
||||
if(type.getBaseLangType() != null) {
|
||||
return getTranslation(type.getBaseLangType()) + " (" + app.getLangTranslation(type.getLang()).toLowerCase() +")";
|
||||
if (type.getBaseLangType() != null) {
|
||||
return getTranslation(type.getBaseLangType()) + " (" + app.getLangTranslation(type.getLang()).toLowerCase() + ")";
|
||||
}
|
||||
return getTranslation(type.getIconKeyName());
|
||||
}
|
||||
|
@ -352,19 +351,26 @@ public class AppInitializer implements IProgress {
|
|||
return app.getString(in);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.debug("No translation for "+ keyName + " " + e.getMessage());
|
||||
LOG.debug("No translation for " + keyName + " " + e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSynonyms(AbstractPoiType type) {
|
||||
if(type.getBaseLangType() != null) {
|
||||
if (type.getBaseLangType() != null) {
|
||||
return getSynonyms(type.getBaseLangType());
|
||||
}
|
||||
return getSynonyms(type.getIconKeyName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEnSynonyms(AbstractPoiType type) {
|
||||
if (type.getBaseLangType() != null) {
|
||||
return getSynonyms(type.getBaseLangType());
|
||||
}
|
||||
return getEnSynonyms(type.getIconKeyName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSynonyms(String keyName) {
|
||||
|
@ -375,23 +381,40 @@ public class AppInitializer implements IProgress {
|
|||
return app.getString(in);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// LOG.debug("No translation for "+ keyName + " " + e.getMessage());
|
||||
LOG.debug("No translation for " + keyName + " " + e.getMessage());
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEnSynonyms(String keyName) {
|
||||
if (en == null) {
|
||||
return Algorithms.capitalizeFirstLetter(
|
||||
keyName.replace('_', ' '));
|
||||
}
|
||||
try {
|
||||
Field f = R.string.class.getField("synonyms_poi_" + keyName);
|
||||
if (f != null) {
|
||||
Integer in = (Integer) f.get(null);
|
||||
return en.getString(in);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.debug("No translation for " + keyName + " " + e.getMessage());
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEnTranslation(AbstractPoiType type) {
|
||||
if(type.getBaseLangType() != null) {
|
||||
return getEnTranslation(type.getBaseLangType()) + " (" + app.getLangTranslation(type.getLang()).toLowerCase() +")";
|
||||
if (type.getBaseLangType() != null) {
|
||||
return getEnTranslation(type.getBaseLangType()) + " (" + app.getLangTranslation(type.getLang()).toLowerCase() + ")";
|
||||
}
|
||||
return getEnTranslation(type.getIconKeyName());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getEnTranslation(String keyName) {
|
||||
if(en == null) {
|
||||
if (en == null) {
|
||||
return Algorithms.capitalizeFirstLetter(
|
||||
keyName.replace('_', ' '));
|
||||
}
|
||||
|
@ -402,7 +425,7 @@ public class AppInitializer implements IProgress {
|
|||
return en.getString(in);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.debug("No translation for "+ keyName + " " + e.getMessage());
|
||||
LOG.debug("No translation for " + keyName + " " + e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue