Package translate :: Package storage :: Module poheader :: Class poheader

[hide private]
[frames] | no frames]

# Class poheader

source code

    object --+
             |
            poheader

Known Subclasses:
  - pocommon.pofile
  - , poxliff.PoXliffFile

This class implements functionality for manipulation of po file headers. This class is a mix-in class and useless on its own. It must be used from all classes which represent a po file

Instance Methods | [hide private]

dict

makeheaderdict(self, charset=`'``CHARSET``'`, encoding=`'``ENCODING``'`, project_id_version=None, pot_creation_date=None, po_revision_date=None, last_translator=None, language_team=None, mime_version=None, plural_forms=None, report_msgid_bugs_to=None, **kwargs) create a header for the given filename. | source code

header(self) Returns the header element, or None. | source code

parseheader(self) Parses the PO header and returns the interpreted values as a dictionary | source code

updateheader(self, add=False, **kwargs) Updates the fields in the PO style header. | source code

getheaderplural(self) returns the nplural and plural values from the header | source code

updateheaderplural(self, nplurals, plural) update the Plural-Form PO header | source code

mergeheaders(self, otherstore) Merges another header with this header. | source code

updatecontributor(self, name, email=None) Add contribution comments | source code

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

Class Variables | [hide private]

| x_generator = ``'``Translate Toolkit 1.2.0-rc1``'``
| header_order = ``[``'``Project-Id-Version``'``,` `'``Report-Msgid-Bugs-To``'``,` `...``

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### makeheaderdict(self, charset=`'``CHARSET``'`, encoding=`'``ENCODING``'`, project_id_version=None, pot_creation_date=None, po_revision_date=None, last_translator=None, language_team=None, mime_version=None, plural_forms=None, report_msgid_bugs_to=None, **kwargs)

source code

create a header for the given filename. arguments are specially handled, kwargs added as key: value pot_creation_date can be None (current date) or a value (datetime or string) po_revision_date can be None (form), False (=pot_creation_date), True (=now), or a value (datetime or string)

Returns: dict
  Dictionary with the header items

### header(self)

source code

Returns the header element, or None. Only the first element is allowed to be a header. Note that this could still return an empty header element, if present.

### updateheader(self, add=False, **kwargs)

source code

Updates the fields in the PO style header. This will create a header if add == True

### mergeheaders(self, otherstore)

source code

Merges another header with this header.

This header is assumed to be the template.

Parameters:
  - `otherstore` (base.TranslationStore)

Class Variable Details | [hide private]

### header_order

Value:

      ['Project-Id-Version',
       'Report-Msgid-Bugs-To',
       'POT-Creation-Date',
       'PO-Revision-Date',
       'Last-Translator',
       'Language-Team',
       'MIME-Version',
       'Content-Type',
      ...