Mercurial > babel > old > babel-test
comparison 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 |
comparison
equal
deleted
inserted
replaced
475:1dd3592c6159 | 476:2c6f5e610e86 |
---|---|
376 if isinstance(text, unicode): | 376 if isinstance(text, unicode): |
377 text = text.encode(catalog.charset) | 377 text = text.encode(catalog.charset) |
378 fileobj.write(text) | 378 fileobj.write(text) |
379 | 379 |
380 def _write_comment(comment, prefix=''): | 380 def _write_comment(comment, prefix=''): |
381 lines = comment | 381 # xgettext always wraps comments even if --no-wrap is passed; |
382 # provide the same behaviour | |
382 if width and width > 0: | 383 if width and width > 0: |
383 lines = wraptext(comment, width) | 384 _width = width |
384 for line in lines: | 385 else: |
386 _width = 76 | |
387 for line in wraptext(comment, _width): | |
385 _write('#%s %s\n' % (prefix, line.strip())) | 388 _write('#%s %s\n' % (prefix, line.strip())) |
386 | 389 |
387 def _write_message(message, prefix=''): | 390 def _write_message(message, prefix=''): |
388 if isinstance(message.id, (list, tuple)): | 391 if isinstance(message.id, (list, tuple)): |
389 _write('%smsgid %s\n' % (prefix, _normalize(message.id[0], prefix))) | 392 _write('%smsgid %s\n' % (prefix, _normalize(message.id[0], prefix))) |