diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-09-12 19:44:51 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-09-12 19:44:51 +0200 |
commit | 8857f9341c46ce1294c56bc5c729e126884be10c (patch) | |
tree | 7319b85fa29ff9c727f9b4e2a47629e7f3c3d330 /src/main/java/de/pixart/messenger | |
parent | 85b8ec7702f5423c82d601c9c265415de344e26e (diff) |
inherit language from parent message when finding localized body
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/xml/LocalizedContent.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/main/java/de/pixart/messenger/xml/LocalizedContent.java b/src/main/java/de/pixart/messenger/xml/LocalizedContent.java index be7c2e77e..c327ded83 100644 --- a/src/main/java/de/pixart/messenger/xml/LocalizedContent.java +++ b/src/main/java/de/pixart/messenger/xml/LocalizedContent.java @@ -22,10 +22,12 @@ public class LocalizedContent { public static LocalizedContent get(final Element element, String name) { final HashMap<String, String> contents = new HashMap<>(); + final String parentLanguage = element.getAttribute("xml:lang"); for (Element child : element.children) { if (name.equals(child.getName())) { final String namespace = child.getNamespace(); - final String lang = child.getAttribute("xml:lang"); + final String childLanguage = child.getAttribute("xml:lang"); + final String lang = childLanguage == null ? parentLanguage : childLanguage; final String content = child.getContent(); if (content != null && (namespace == null || "jabber:client".equals(namespace))) { if (contents.put(lang, content) != null) { |