diff babel/messages/pofile.py @ 84:4ff9cc26c11b

Some cosmetic changes for the new translator comments support.
author cmlenz
date Sun, 10 Jun 2007 18:03:46 +0000
parents 9c84b9fa5d30
children b176f325d127
line wrap: on
line diff
--- a/babel/messages/pofile.py
+++ b/babel/messages/pofile.py
@@ -69,6 +69,7 @@
     translations = []
     locations = []
     flags = []
+    comments = []
     in_msgid = in_msgstr = False
 
     def _add_message():
@@ -81,8 +82,9 @@
             string = tuple([t[1] for t in translations])
         else:
             string = translations[0][1]
-        catalog.add(msgid, string, list(locations), set(flags))
-        del messages[:]; del translations[:]; del locations[:]; del flags[:]
+        catalog.add(msgid, string, list(locations), set(flags), list(comments))
+        del messages[:]; del translations[:]; del locations[:];
+        del flags[:]; del comments[:]
 
     for line in fileobj.readlines():
         line = line.strip()
@@ -97,6 +99,8 @@
             elif line[1:].startswith(','):
                 for flag in line[2:].lstrip().split(','):
                     flags.append(flag.strip())
+            elif line[1:].startswith('.'):
+                comments.append(line[2:].strip)
         elif line:
             if line.startswith('msgid_plural'):
                 in_msgid = True
Copyright (C) 2012-2017 Edgewall Software