comparison babel/messages/pofile.py @ 546:10de195cfb04

catalog.add() now returns the message instance (closes #245)
author fschwarz
date Sat, 19 Mar 2011 19:28:59 +0000
parents 1869978e3895
children 12d5425fb430
comparison
equal deleted inserted replaced
543:1d386483ccb6 546:10de195cfb04
343 message catalog to the provided file-like object. 343 message catalog to the provided file-like object.
344 344
345 >>> catalog = Catalog() 345 >>> catalog = Catalog()
346 >>> catalog.add(u'foo %(name)s', locations=[('main.py', 1)], 346 >>> catalog.add(u'foo %(name)s', locations=[('main.py', 1)],
347 ... flags=('fuzzy',)) 347 ... flags=('fuzzy',))
348 <Message...>
348 >>> catalog.add((u'bar', u'baz'), locations=[('main.py', 3)]) 349 >>> catalog.add((u'bar', u'baz'), locations=[('main.py', 3)])
350 <Message...>
349 >>> from StringIO import StringIO 351 >>> from StringIO import StringIO
350 >>> buf = StringIO() 352 >>> buf = StringIO()
351 >>> write_po(buf, catalog, omit_header=True) 353 >>> write_po(buf, catalog, omit_header=True)
352 >>> print buf.getvalue() 354 >>> print buf.getvalue()
353 #: main.py:1 355 #: main.py:1
Copyright (C) 2012-2017 Edgewall Software