From a7c47a33fafc8295bb076e0919c5cbd58da87042 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Thu, 12 Sep 2019 12:42:42 +0200 Subject: [PATCH] inherit language from parent message when finding localized body --- .../java/eu/siacs/conversations/xml/LocalizedContent.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/siacs/conversations/xml/LocalizedContent.java b/src/main/java/eu/siacs/conversations/xml/LocalizedContent.java index ee70df859..57a2f3dba 100644 --- a/src/main/java/eu/siacs/conversations/xml/LocalizedContent.java +++ b/src/main/java/eu/siacs/conversations/xml/LocalizedContent.java @@ -22,10 +22,12 @@ public class LocalizedContent { public static LocalizedContent get(final Element element, String name) { final HashMap 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) {