Mercurial > babel > mirror
diff babel/messages/pofile.py @ 423:fb926f48efba trunk
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 | palgarvio |
---|---|
date | Tue, 23 Dec 2008 01:03:40 +0000 |
parents | fcde0f2ff278 |
children | a974d298400f |
line wrap: on
line diff
--- a/babel/messages/pofile.py +++ b/babel/messages/pofile.py @@ -388,10 +388,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=''):