diff --git a/src/webui/webapplication.cpp b/src/webui/webapplication.cpp index 6a339d159..d175cb2a5 100644 --- a/src/webui/webapplication.cpp +++ b/src/webui/webapplication.cpp @@ -265,9 +265,11 @@ void WebApplication::translateDocument(QString &data) const // it should fallback to `sourceText` QString translation = loadedText.isEmpty() ? sourceText : loadedText; - // Use HTML code for quotes to prevent issues with JS - translation.replace(u'\'', u"'"_s); - translation.replace(u'\"', u"""_s); + // Escape quotes to workaround issues with HTML attributes + // FIXME: this is a dirty workaround to deal with broken translation strings: + // 1. Translation strings is the culprit of the issue, they should be fixed instead + // 2. The escaped quote/string is wrong for JS. JS use backslash to escape the quote: "\"" + translation.replace(u'"', u"""_s); data.replace(i, regexMatch.capturedLength(), translation); i += translation.length();