fall back to random subject langugae in case there is no english one

This commit is contained in:
Christian Schneppe 2018-07-15 22:59:19 +02:00
parent 7927ee014c
commit 9018eabd6d

View file

@ -73,7 +73,7 @@ public class Element {
return findInternationalizedChildContent(name, Locale.getDefault().getLanguage());
}
public String findInternationalizedChildContent(String name, @NonNull String language) {
private String findInternationalizedChildContent(String name, @NonNull String language) {
HashMap<String, String> contents = new HashMap<>();
for (Element child : this.children) {
if (name.equals(child.getName())) {
@ -88,8 +88,11 @@ public class Element {
}
}
}
return contents.get(null);
String value = contents.get(null);
if (value != null) {
return value;
}
return contents.size() > 0 ? contents.values().iterator().next() : null;
}
public Element findChild(String name, String xmlns) {