PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB` babel.messages.mofile
Package babel :: Package messages :: Module mofile

Module mofile

Writing of files in the gettext MO (machine object) format.

Since: version 0.9

See Also: The Format of MO Files

Functions
 
write_mo(fileobj, catalog, use_fuzzy=False)
Write a catalog to the specified file-like object using the GNU MO file format.
Function Details

write_mo(fileobj, catalog, use_fuzzy=False)

 

Write a catalog to the specified file-like object using the GNU MO file format.

>>> from babel.messages import Catalog
>>> from gettext import GNUTranslations
>>> from StringIO import StringIO
>>> catalog = Catalog(locale='en_US')
>>> catalog.add('foo', 'Voh')
>>> catalog.add((u'bar', u'baz'), (u'Bahr', u'Batz'))
>>> catalog.add('fuz', 'Futz', flags=['fuzzy'])
>>> catalog.add('Fizz', '')
>>> catalog.add(('Fuzz', 'Fuzzes'), ('', ''))
>>> buf = StringIO()
>>> write_mo(buf, catalog)
>>> buf.seek(0)
>>> translations = GNUTranslations(fp=buf)
>>> translations.ugettext('foo')
u'Voh'
>>> translations.ungettext('bar', 'baz', 1)
u'Bahr'
>>> translations.ungettext('bar', 'baz', 2)
u'Batz'
>>> translations.ugettext('fuz')
u'fuz'
>>> translations.ugettext('Fizz')
u'Fizz'
>>> translations.ugettext('Fuzz')
u'Fuzz'
>>> translations.ugettext('Fuzzes')
u'Fuzzes'
Parameters:
  • fileobj - the file-like object to write to
  • catalog - the Catalog instance
  • use_fuzzy - whether translations marked as "fuzzy" should be included in the output