polib.MOFile

Module polib :: Class MOFile |
[hide private]
[frames] | no frames]

# Class MOFile

source code

    object --+
             |
          list --+
                 |
         _BaseFile --+
                     |
                    MOFile

Mo file reader/writer. MOFile objects inherit the list objects methods.

Example:

    >>> mo = MOFile()
    >>> entry1 = POEntry(
    ...     msgid="Some english text",
    ...     msgstr="Un texte en anglais"
    ... )
    >>> entry2 = POEntry(
    ...     msgid="I need my dirty cheese",
    ...     msgstr="Je veux mon sale fromage"
    ... )
    >>> mo.append(entry1)
    >>> mo.append(entry2)
    >>> print mo
    msgid ""
    msgstr ""
    <BLANKLINE>
    msgid "Some english text"
    msgstr "Un texte en anglais"
    <BLANKLINE>
    msgid "I need my dirty cheese"
    msgstr "Je veux mon sale fromage"
    <BLANKLINE>

Instance Methods | [hide private]
__init__(self, fpath=None, wrapwidth=78) MOFile constructor. | source code
save_as_pofile(self, fpath) Save the string representation of the file to fpath. | source code
save(self, fpath) Save the binary representation of the file to fpath. | source code
Inherited from `_BaseFile`: `__repr__`, `__str__`, `charset`, `metadata_as_entry`, `ordered_metadata`, `to_binary` Inherited from `list`: `__add__`, `__contains__`, `__delitem__`, `__delslice__`, `__eq__`, `__ge__`, `__getattribute__`, `__getitem__`, `__getslice__`, `__gt__`, `__hash__`, `__iadd__`, `__imul__`, `__iter__`, `__le__`, `__len__`, `__lt__`, `__mul__`, `__ne__`, `__new__`, `__reversed__`, `__rmul__`, `__setitem__`, `__setslice__`, `append`, `count`, `extend`, `index`, `insert`, `pop`, `remove`, `reverse`, `sort` Inherited from `object`: `__delattr__`, `__reduce__`, `__reduce_ex__`, `__setattr__`

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, fpath=None, wrapwidth=78) (Constructor) | source code
MOFile constructor. See _BaseFile.__construct. Overrides: _BaseFile.__init__

### save_as_pofile(self, fpath) | source code
Save the string representation of the file to fpath. Keyword argument: fpath: string, full or relative path to the file.

### save(self, fpath) | source code
Save the binary representation of the file to fpath. Keyword argument: fpath: string, full or relative path to the file. Overrides: _BaseFile.save