mail[Wesnoth-commits] r34321 - /trunk/data/tools/wmlxgettext


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by esr on March 31, 2009 - 03:27:
Author: esr
Date: Tue Mar 31 03:27:49 2009
New Revision: 34321

URL: http://svn.gna.org/viewcvs/wesnoth?rev=34321&view=rev
Log:
Generate po headers.

Modified:
    trunk/data/tools/wmlxgettext

Modified: trunk/data/tools/wmlxgettext
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/tools/wmlxgettext?rev=34321&r1=34320&r2=34321&view=diff
==============================================================================
--- trunk/data/tools/wmlxgettext (original)
+++ trunk/data/tools/wmlxgettext Tue Mar 31 03:27:49 2009
@@ -67,6 +67,20 @@
    Options may be followed by any number of directiories to check.  If no
    directories are given, all files under the current directory are checked.
 """)
+
+    print '''\
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\\n"
+"Report-Msgid-Bugs-To: http://bugs.wesnoth.org/\\n";
+"POT-Creation-Date: %s\\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\\n"
+"Last-Translator: FULL NAME <EMAIL\@ADDRESS>\\n"
+"Language-Team: LANGUAGE <LL\@li.org>\\n"
+"MIME-Version: 1.0\\n"
+"Content-Type: text/plain; charset=UTF-8\\n"
+"Content-Transfer-Encoding: 8bit\\n"
+''' % time.strftime("%Y-%m-%d, %H:%M+0000", time.gmtime())
 
     try:
         directory = '.'
@@ -183,16 +197,18 @@
             print "Contexts:"
             for (key, value) in contexts.items():
                 print key, "->", value
-        # Generate a report from the translattables
+        # Generate a report from the translatables
         for (translatable, context) in translatables:
             attribs = ""
-            for (tag, file, line) in context[:-1]:
-                for (key, value) in contexts.items():
-                    value = filter(interesting, value)
-                    if key[0] == tag and key[1] == file and key[2] == line:
-                        attribs = " has " + ", ".join(value)
-                print "%s, line %d: %s%s" % (file, line, tag, attribs)
-            print "%s, line %d: %s" % (context[-1][1], context[-1][2], 
context[-1][0])
+            for (i, (tag, file, line)) in enumerate(context):
+                if i == len(context)-1 or tag.startswith("{"):
+                    print "# %s, line %d: %s" % (file, line, tag)
+                else:
+                    for (key, value) in contexts.items():
+                        value = filter(interesting, value)
+                        if key[0] == tag and key[1] == file and key[2] == 
line:
+                            attribs = " has " + ", ".join(value)
+                    print "# %s, line %d: %s%s" % (file, line, tag, attribs)
             print 'msgid "%s"' % translatable
             print 'msgstr ""'
             print ""




Related Messages


Powered by MHonArc, Updated Tue Mar 31 04:40:45 2009