[rkward-cvs] [rkward] rkward/misc: Minor cleanup

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Mon Dec 8 11:06:01 UTC 2014


Git commit 72017cfed8dc80494d952c1ce0c7c8cf1551105a by Thomas Friedrichsmeier.
Committed on 08/12/2014 at 10:03.
Pushed by tfry into branch 'master'.

Minor cleanup

M  +3    -7    rkward/misc/xmlhelper.cpp

http://commits.kde.org/rkward/72017cfed8dc80494d952c1ce0c7c8cf1551105a

diff --git a/rkward/misc/xmlhelper.cpp b/rkward/misc/xmlhelper.cpp
index d9dba22..d18c068 100644
--- a/rkward/misc/xmlhelper.cpp
+++ b/rkward/misc/xmlhelper.cpp
@@ -247,8 +247,8 @@ QString XMLHelper::i18nStringAttribute (const QDomElement& element, const QStrin
 		displayError (&element, i18n ("'%1'-attribute not given. Assuming '%2'", name, def), debug_level);
 		return def;
 	}
-	const QString context_element ("i18n_context");
-	if (element.hasAttribute (context_element)) return (catalog->translate (element.attribute (context_element), element.attribute (name)));
+	const QString context = element.attribute ("i18n_context", QString ());
+	if (!context.isNull ()) return (catalog->translate (context, element.attribute (name)));
 	return (catalog->translate (element.attribute (name)));
 }
 
@@ -331,11 +331,7 @@ QString XMLHelper::i18nElementText (const QDomElement &element, bool with_paragr
 		return QString ();
 	}
 
-	const QString context_attr ("i18n_context");
-	QString context;
-	if (element.hasAttribute (context_attr)) {
-		context = element.attribute (context_attr);
-	}
+	QString context = element.attribute ("i18n_context", QString ());
 
 	// if (!with_paragraphs), text should better not contain double newlines. We treat all the same, though, just as the message extraction script does.
 	QStringList paras = ret.split ("\n\n");





More information about the rkward-tracker mailing list