[rkward-cvs] SF.net SVN: rkward-code:[4970] trunk/rkward/rkward/misc/xmlhelper.cpp

tfry at users.sf.net tfry at users.sf.net
Tue Oct 28 11:16:18 UTC 2014


Revision: 4970
          http://sourceforge.net/p/rkward/code/4970
Author:   tfry
Date:     2014-10-28 11:16:17 +0000 (Tue, 28 Oct 2014)
Log Message:
-----------
Don't forget to support message context.

Modified Paths:
--------------
    trunk/rkward/rkward/misc/xmlhelper.cpp

Modified: trunk/rkward/rkward/misc/xmlhelper.cpp
===================================================================
--- trunk/rkward/rkward/misc/xmlhelper.cpp	2014-10-28 10:04:07 UTC (rev 4969)
+++ trunk/rkward/rkward/misc/xmlhelper.cpp	2014-10-28 11:16:17 UTC (rev 4970)
@@ -330,13 +330,19 @@
 		displayError (&element, i18n ("Trying to retrieve contents of invalid element"), debug_level);
 	}
 
+	const QString context_attr ("i18n_context");
+	QString context;
+	if (element.hasAttribute (context_attr)) {
+		context = element.attribute (context_attr);
+	}
+
 	QStringList paras = ret.split ("\n\n");
 	ret.clear ();
 	for (int i = 0; i < paras.count (); ++i) {
 		QString para = paras[i].simplified ();
 		if (!para.isEmpty ()) {
 			if (!ret.isEmpty ()) ret.append ("\n");
-			ret += "<p>" + catalog->translate (para) + "</p>";
+			ret += "<p>" + context.isNull () ? catalog->translate (para) : catalog->translate (context, para) + "</p>";
 		}
 	}
 





More information about the rkward-tracker mailing list