diff babel/messages/pofile.py @ 476:2c6f5e610e86 stable-0.9.x

Merged revisions 465 via svnmerge from http://svn.edgewall.org/repos/babel/trunk ........ r465 | palgarvio | 2008-12-23 02:03:40 +0100 (di, 23 dec 2008) | 3 lines Now, the `--width` option, although with a default value of 76, it's not set to any value initially so that the `--no-wrap` option can be passed without throwing an error. Fixes #145. With the above bug, another one was found where Babel was not mimic'ing xgtettext's behaviour regarding the `--no-wrap` option where comments are wrapped anyway to the width of 76, and, if `--width` is passed then that value is used to wrap the comments too. ........
author jruigrok
date Sun, 11 Apr 2010 08:40:17 +0000
parents c6babc3bbc10
children b29ff192b610
line wrap: on
line diff
--- a/babel/messages/pofile.py
+++ b/babel/messages/pofile.py
@@ -378,10 +378,13 @@
         fileobj.write(text)
 
     def _write_comment(comment, prefix=''):
-        lines = comment
+        # xgettext always wraps comments even if --no-wrap is passed;
+        # provide the same behaviour
         if width and width > 0:
-            lines = wraptext(comment, width)
-        for line in lines:
+            _width = width
+        else:
+            _width = 76
+        for line in wraptext(comment, _width):
             _write('#%s %s\n' % (prefix, line.strip()))
 
     def _write_message(message, prefix=''):
Copyright (C) 2012-2017 Edgewall Software