Some fixes:
authorBastien Montagne <montagne29@wanadoo.fr>
Mon, 14 Jan 2013 21:41:21 +0000 (21:41 +0000)
committerBastien Montagne <montagne29@wanadoo.fr>
Mon, 14 Jan 2013 21:41:21 +0000 (21:41 +0000)
* handle nicely multiple empty lines in po files (still have to figure out why po writer sometime output two lines instead of one!)
* fix rtl processing!

release/scripts/modules/bl_i18n_utils/import_po_from_branches.py
release/scripts/modules/bl_i18n_utils/utils.py

index f42b45e7d4e1fa9e1a3cb0beec871d86fd1533a9..956d2e961549edc0bec66824a483b3103fce1c1e 100755 (executable)
@@ -84,8 +84,8 @@ def main():
                             trans.append(m.msgstr)
                         trans = rtl_preprocess.log2vis(trans)
                         for k, t in zip(keys, trans):
-                            msgs[k].msgstr = t
-                        msgs.write(kinf='PO', dest=out_po)
+                            msgs.msgs[k].msgstr = t
+                        msgs.write(kind='PO', dest=out_po)
                         # Also copies org po!
                         shutil.copy(po, out_raw_po)
                         print("{:<10}: {:>6.1%} done, enough translated messages, processed and copied to trunk."
index 891bbae3871d9d082ccb43de734698934fd52072..1c2e62b4c4e6ba52168609f675c2e9ffbf8cc637 100644 (file)
@@ -412,7 +412,9 @@ class I18nMessages:
         # Main loop over all lines in src...
         for line_nr, line in enumerate(src.splitlines()):
             if line == "":
-                finalize_message(self, line_nr)
+                if reading_msgstr:
+                    finalize_message(self, line_nr)
+                continue
 
             elif line.startswith(PO_MSGCTXT) or line.startswith(_comm_msgctxt):
                 reading_comment = False
@@ -493,6 +495,7 @@ class I18nMessages:
                     msgstr_lines.append(line)
                 else:
                     self.parsing_errors.append((line_nr, "regular string outside msgctxt, msgid or msgstr scope"))
+                    #self.parsing_errors += (str(comment_lines), str(msgctxt_lines), str(msgid_lines), str(msgstr_lines))
 
         # If no final empty line, last message is not finalized!
         if reading_msgstr: