Package translate :: Package storage :: Module pypo :: Class pofile

[hide private]
[frames] | no frames]

# Class pofile

source code

               object --+
                        |
    base.TranslationStore --+
                            |
               object --+   |
                        |   |
        poheader.poheader --+
                            |
              pocommon.pofile --+
                                |
                               pofile

this represents a .po file containing various units

Nested Classes | [hide private]

| UnitClass Base class for translation units.

Instance Methods | [hide private]

__init__(self, inputfile=None, encoding=None, unitclass=<class 'translate.storage.pypo.pounit'>) construct a pofile, optionally reading in from inputfile. | source code

changeencoding(self, newencoding) changes the encoding on the file | source code

parse(self, input) parses the given file or file source string | source code

removeduplicates(self, duplicatestyle=`'``merge``'`) make sure each msgid is unique ; merge comments etc from duplicates into original | source code

__str__(self) convert to a string. | source code

_getoutput(self) convert the units back to lines | source code

encode(self, lines) encode any unicode strings in lines in self._encoding | source code

decode(self, lines) decode any non-unicode strings in lines with self._encoding | source code

unit_iter(self) Iterator over all the units in this store. | source code

Inherited from `pocommon.pofile`: `makeheader`

Inherited from `base.TranslationStore`: `addsourceunit`, `addunit`, `findunit`, `getunits`, `isempty`, `makeindex`, `save`, `savefile`, `setsourcelanguage`, `settargetlanguage`, `translate`

Inherited from `base.TranslationStore` (private): `_assignname`

Inherited from `poheader.poheader`: `getheaderplural`, `header`, `makeheaderdict`, `mergeheaders`, `parseheader`, `updatecontributor`, `updateheader`, `updateheaderplural`

Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`

Class Methods | [hide private]

Inherited from `base.TranslationStore`: `parsefile`, `parsestring`

Class Variables | [hide private]

Inherited from `pocommon.pofile`: `Extensions`, `Mimetypes`, `Name` Inherited from `poheader.poheader`: `header_order`, `x_generator`

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, inputfile=None, encoding=None, unitclass=<class 'translate.storage.pypo.pounit'>)
(Constructor)

source code

construct a pofile, optionally reading in from inputfile. encoding can be specified but otherwise will be read from the PO header

Overrides: object.__init__

### parse(self, input)

source code

parses the given file or file source string

Overrides: base.TranslationStore.parse

### __str__(self)
(Informal representation operator)

source code

convert to a string. double check that unicode is handled somehow here

Overrides: object.__str__

### unit_iter(self)

source code

Iterator over all the units in this store.

Overrides: base.TranslationStore.unit_iter
  (inherited documentation)