[rkward-cvs] SF.net SVN: rkward-code:[4955] trunk/rkward/scripts/extract_plugin_messages .py

tfry at users.sf.net tfry at users.sf.net
Sat Oct 25 13:36:51 UTC 2014


Revision: 4955
          http://sourceforge.net/p/rkward/code/4955
Author:   tfry
Date:     2014-10-25 13:36:50 +0000 (Sat, 25 Oct 2014)
Log Message:
-----------
Further improve context information

Modified Paths:
--------------
    trunk/rkward/scripts/extract_plugin_messages.py

Modified: trunk/rkward/scripts/extract_plugin_messages.py
===================================================================
--- trunk/rkward/scripts/extract_plugin_messages.py	2014-10-25 08:47:49 UTC (rev 4954)
+++ trunk/rkward/scripts/extract_plugin_messages.py	2014-10-25 13:36:50 UTC (rev 4955)
@@ -46,7 +46,10 @@
     element = element.parentNode
     if (element.tagName == "document"):
       break # Ignore <document>-tag, it is not informative
-    tag_stack.insert (0, "<" + element.tagName + ">")
+    t = "<" + element.tagName
+    if (element.hasAttribute ("label")):  # Where available, include the labels of parent elements. Particularly helpful for radio-options
+      t += " label=" + quote (element.getAttribute ("label"))
+    tag_stack.insert (0, t + ">")
   ts = tag_stack[-4:]
   if (len (tag_stack) > 3):
     ts[0] = tag_stack[0]
@@ -100,7 +103,8 @@
       outfile.write (getI18nComment (node, "label"))
       if (node.hasAttribute ("i18n_context")):
         outfile.write ("i18nc (" + quote (node.getAttribute ("i18n_context")) + ", " + quote (node.getAttribute ("label")) + ");\n")
-      outfile.write ("i18n (" + quote (node.getAttribute ("label")) + ");\n")
+      else:
+        outfile.write ("i18n (" + quote (node.getAttribute ("label")) + ");\n")
     if (node.hasAttribute ("file")):
       if (node.tagName != "code"):
         # TODO: handle .js files





More information about the rkward-tracker mailing list