[rkward-cvs] [rkward] rkward/misc: Don't try to translate empty strings

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Thu Feb 5 17:14:54 UTC 2015


Git commit 2bd63162b2760fe53ddba6c6801f1336d17eff60 by Thomas Friedrichsmeier.
Committed on 05/02/2015 at 17:13.
Pushed by tfry into branch 'master'.

Don't try to translate empty strings

M  +6    -2    rkward/misc/xmlhelper.cpp

http://commits.kde.org/rkward/2bd63162b2760fe53ddba6c6801f1336d17eff60

diff --git a/rkward/misc/xmlhelper.cpp b/rkward/misc/xmlhelper.cpp
index d18c068..bb60f80 100644
--- a/rkward/misc/xmlhelper.cpp
+++ b/rkward/misc/xmlhelper.cpp
@@ -247,9 +247,13 @@ QString XMLHelper::i18nStringAttribute (const QDomElement& element, const QStrin
 		displayError (&element, i18n ("'%1'-attribute not given. Assuming '%2'", name, def), debug_level);
 		return def;
 	}
+
+	QString attr = element.attribute (name);
+	if (attr.isEmpty ()) return attr;	// Do not translate empty strings!
+
 	const QString context = element.attribute ("i18n_context", QString ());
-	if (!context.isNull ()) return (catalog->translate (context, element.attribute (name)));
-	return (catalog->translate (element.attribute (name)));
+	if (!context.isNull ()) return (catalog->translate (context, attr));
+	return (catalog->translate (attr));
 }
 
 int XMLHelper::getMultiChoiceAttribute (const QDomElement &element, const QString &name, const QString &values, int def, int debug_level) {


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
rkward-cvs mailing list
rkward-cvs at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rkward-cvs


More information about the rkward-tracker mailing list