Inline synonyms into string
This commit is contained in:
parent
603ae34b5a
commit
c426a5f31d
2 changed files with 35 additions and 6 deletions
|
@ -351,7 +351,14 @@ public class AppInitializer implements IProgress {
|
||||||
Field f = R.string.class.getField("poi_" + keyName);
|
Field f = R.string.class.getField("poi_" + keyName);
|
||||||
if (f != null) {
|
if (f != null) {
|
||||||
Integer in = (Integer) f.get(null);
|
Integer in = (Integer) f.get(null);
|
||||||
return app.getString(in);
|
String val = app.getString(in);
|
||||||
|
if(val != null) {
|
||||||
|
int ind = val.indexOf(';');
|
||||||
|
if (ind > 0) {
|
||||||
|
return val.substring(0, ind);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return val;
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
LOG.info("No translation: " + keyName);
|
LOG.info("No translation: " + keyName);
|
||||||
|
@ -372,10 +379,18 @@ public class AppInitializer implements IProgress {
|
||||||
@Override
|
@Override
|
||||||
public String getSynonyms(String keyName) {
|
public String getSynonyms(String keyName) {
|
||||||
try {
|
try {
|
||||||
Field f = R.string.class.getField("synonyms_poi_" + keyName);
|
Field f = R.string.class.getField("poi_" + keyName);
|
||||||
if (f != null) {
|
if (f != null) {
|
||||||
Integer in = (Integer) f.get(null);
|
Integer in = (Integer) f.get(null);
|
||||||
return app.getString(in);
|
String val = app.getString(in);
|
||||||
|
if(val != null) {
|
||||||
|
int ind = val.indexOf(';');
|
||||||
|
if(ind > 0) {
|
||||||
|
return val.substring(ind + 1);
|
||||||
|
}
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
return val;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,7 +200,14 @@ public class SampleApplication extends Application {
|
||||||
Field f = R.string.class.getField("poi_" + type.getIconKeyName());
|
Field f = R.string.class.getField("poi_" + type.getIconKeyName());
|
||||||
if (f != null) {
|
if (f != null) {
|
||||||
Integer in = (Integer) f.get(null);
|
Integer in = (Integer) f.get(null);
|
||||||
return getString(in);
|
String val = getString(in);
|
||||||
|
if(val != null) {
|
||||||
|
int ind = val.indexOf(';');
|
||||||
|
if (ind > 0) {
|
||||||
|
return val.substring(0, ind);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return val;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.err.println("No translation for "+ type.getIconKeyName() + " " + e.getMessage());
|
System.err.println("No translation for "+ type.getIconKeyName() + " " + e.getMessage());
|
||||||
|
@ -241,10 +248,17 @@ public class SampleApplication extends Application {
|
||||||
@Override
|
@Override
|
||||||
public String getSynonyms(String keyName) {
|
public String getSynonyms(String keyName) {
|
||||||
try {
|
try {
|
||||||
Field f = R.string.class.getField("synonyms_poi_" + keyName);
|
Field f = R.string.class.getField("poi_" + keyName);
|
||||||
if (f != null) {
|
if (f != null) {
|
||||||
Integer in = (Integer) f.get(null);
|
Integer in = (Integer) f.get(null);
|
||||||
return getString(in);
|
String val = getString(in);
|
||||||
|
if(val != null) {
|
||||||
|
int ind = val.indexOf(';');
|
||||||
|
if (ind > 0) {
|
||||||
|
return val.substring(ind + 1) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return val;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue