added check for name of category

This commit is contained in:
Chumva 2018-03-21 13:15:06 +02:00
parent 4591866a71
commit c4bf936b60
4 changed files with 9 additions and 52 deletions

View file

@ -84,13 +84,6 @@ public abstract class AbstractPoiType {
return synonyms;
}
public String getEnSynonyms() {
if(enSynonyms == null) {
enSynonyms = registry.getEnSynonyms(this);
}
return enSynonyms;
}
public String getEnTranslation() {
if(enTranslation == null) {

View file

@ -60,8 +60,6 @@ public class MapPoiTypes {
String getSynonyms(AbstractPoiType type);
String getSynonyms(String keyName);
String getEnSynonyms(AbstractPoiType type);
String getEnSynonyms(String keyName);
}
public static MapPoiTypes getDefaultNoInit() {
@ -714,16 +712,6 @@ 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);

View file

@ -364,14 +364,6 @@ public class AppInitializer implements IProgress {
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) {
try {
@ -386,24 +378,6 @@ public class AppInitializer implements IProgress {
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) {

View file

@ -374,16 +374,18 @@ public class QuickSearchListAdapter extends ArrayAdapter<QuickSearchListItem> {
SearchUICore searchUICore = searchHelper.getCore();
String searchPhrase = searchUICore.getPhrase().getText(true);
SearchPhrase.NameStringMatcher nm = new SearchPhrase.NameStringMatcher(searchPhrase,
CollatorStringMatcher.StringMatcherMode.CHECK_EQUALS_FROM_SPACE);
CollatorStringMatcher.StringMatcherMode.CHECK_STARTS_FROM_SPACE);
for (String syn : synonyms) {
if (!nm.matches(abstractPoiType.getTranslation())) {
if (nm.matches(abstractPoiType.getEnTranslation())) {
desc = listItem.getTypeName() + " (" + abstractPoiType.getEnTranslation() + ")";
break;
}
if (nm.matches(syn)) {
desc = listItem.getTypeName() + " (" + syn + ")";
break;
} else {
for (String syn : synonyms) {
if (nm.matches(syn)) {
desc = listItem.getTypeName() + " (" + syn + ")";
break;
}
}
}
}
}