comparison babel/messages/pofile.py @ 544:030ddf3f5b13

catalog.add() now returns the message instance (closes #245)
author fschwarz
date Sat, 19 Mar 2011 19:28:59 +0000
parents f642c81ce8cc
children bf8b876cb8c7
comparison
equal deleted inserted replaced
541:aa471d38bcde 544:030ddf3f5b13
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