[rkward-cvs] [rkward] /: Add author-names and -emails information for .pluginmap translations.

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Wed Dec 10 19:00:57 UTC 2014


Git commit 83414b1f889383c555840809869a2ed83ed42667 by Thomas Friedrichsmeier.
Committed on 10/12/2014 at 19:00.
Pushed by tfry into branch 'master'.

Add author-names and -emails information for .pluginmap translations.

M  +25   -4    rkward/plugin/rkcomponentmeta.cpp
M  +2    -0    rkward/plugin/rkcomponentmeta.h
M  +3    -0    scripts/update_plugin_messages.py

http://commits.kde.org/rkward/83414b1f889383c555840809869a2ed83ed42667

diff --git a/rkward/plugin/rkcomponentmeta.cpp b/rkward/plugin/rkcomponentmeta.cpp
index de1b83e..a39cb15 100644
--- a/rkward/plugin/rkcomponentmeta.cpp
+++ b/rkward/plugin/rkcomponentmeta.cpp
@@ -18,6 +18,7 @@
 #include "rkcomponentmeta.h"
 
 #include "../misc/xmlhelper.h"
+#include "../misc/rkmessagecatalog.h"
 #include "../rbackend/rksessionvars.h"
 
 #include <klocale.h>
@@ -59,6 +60,13 @@ RKComponentAboutData::RKComponentAboutData (const QDomElement& e, XMLHelper &xml
 		author.url = xml.getStringAttribute (ae, "url", QString (), DL_INFO);
 		authors.append (author);
 	}
+
+	const QString translator_names_id ("Your names");
+	const QString translator_emails_id ("Your emails");
+	translator_names = xml.messageCatalog ()->translate ("NAME OF TRANSLATORS", translator_names_id);
+	translator_emails = xml.messageCatalog ()->translate ("EMAIL OF TRANSLATORS", translator_emails_id);
+	if (translator_names == translator_names_id) translator_names.clear ();
+	if (translator_emails == translator_emails_id) translator_emails.clear ();
 }
 
 RKComponentAboutData::~RKComponentAboutData () {
@@ -75,10 +83,10 @@ QString RKComponentAboutData::toHtml () const {
 	ret.append ("</p>\n");
 	if (!url.isEmpty ()) ret.append ("URL: <a href=\"" + url + "\">" + url + "</a></p>\n<p>");
 	if (!copyright.isEmpty ()) ret.append (i18n ("Copyright (c): %1", copyright) + "</p>\n<p>");
-	if (!license.isEmpty ()) ret.append (i18n ("License: %1", license) + "</p>\n<p>");
+	if (!license.isEmpty ()) ret.append (i18n ("License: %1", license) + "</p>");
 
 	if (!authors.isEmpty ()) {
-		ret.append ("<b>" + i18n ("Authors:") + "</b></p>\n<p><ul>");
+		ret.append ("\n<p><b>" + i18n ("Authors:") + "</b></p>\n<p><ul>");
 		for (int i = 0; i < authors.size (); ++i) {
 			RKComponentAuthor a = authors[i];
 			ret.append ("<li>" + a.name);
@@ -86,9 +94,22 @@ QString RKComponentAboutData::toHtml () const {
 			if (!a.url.isEmpty ()) ret.append (" (" + a.url + ")");
 			if (!a.roles.isEmpty ()) ret.append ("<br/><i>" + i18nc ("Author roles (contributor, etc.)", "Roles") + "</i>: " + a.roles);
 		}
-		ret.append ("</ul>");
+		ret.append ("</ul></p>");
 	}
-	ret.append ("</p>");
+
+	if (!translator_names.isNull ()) {
+		QStringList tns = translator_names.split (QLatin1Char(','), QString::KeepEmptyParts);
+		QStringList tes = translator_emails.split (QLatin1Char(','), QString::KeepEmptyParts);
+		ret.append ("\n<p><b>" + i18n ("Translators:") + "</b></p>\n<p><ul>");
+		for (int i = 0; i < tns.size (); ++i) {
+			QString tn = tns.value (i);
+			QString te = tes.value (i);
+			if (tn.isEmpty () && te.isEmpty ()) continue;
+			ret.append ("<li>" + tn + " <" + te + "></li>\n");
+		}
+		ret.append ("</ul></p>");
+	}
+
 	return ret;
 }
 
diff --git a/rkward/plugin/rkcomponentmeta.h b/rkward/plugin/rkcomponentmeta.h
index cbe6e8f..fc13adc 100644
--- a/rkward/plugin/rkcomponentmeta.h
+++ b/rkward/plugin/rkcomponentmeta.h
@@ -65,6 +65,8 @@ public:
 	QString url;
 	QString category;
 	QList<RKComponentAuthor> authors;
+	QString translator_names;
+	QString translator_emails;
 };
 
 #endif
diff --git a/scripts/update_plugin_messages.py b/scripts/update_plugin_messages.py
index f74d77d..376982a 100755
--- a/scripts/update_plugin_messages.py
+++ b/scripts/update_plugin_messages.py
@@ -479,6 +479,9 @@ def initialize_pot_file (po_id, po_loc):
   if (not os.path.exists (p_outdir)):
     os.makedirs (p_outdir, 0755)
   outfile = codecs.open (os.path.join (p_outdir, po_id + '.pot.cpp'), mode, 'utf-8')
+  if (mode == 'w'):	# just created
+    outfile.write ('i18nc("NAME OF TRANSLATORS","Your names");\n');
+    outfile.write ('i18nc("EMAIL OF TRANSLATORS","Your emails");\n');
 
 #######
 # Loop over toplevel_sources (specified on command line, or those that want to be split into separate po) and extract messages





More information about the rkward-tracker mailing list