fall back to random subject langugae in case there is no english one
This commit is contained in:
parent
7927ee014c
commit
9018eabd6d
1 changed files with 6 additions and 3 deletions
|
@ -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) {
|
||||
|
|
Reference in a new issue