Package translate :: Package storage :: Module lisa :: Class LISAfile

[hide private]
[frames] | no frames]

# Class LISAfile

source code

A class representing a file store for one of the LISA file formats.

Nested Classes | [hide private]

| UnitClass The class of units that will be instantiated and used by this class

Instance Methods | [hide private]

__init__(self, inputfile=None, sourcelanguage=`'``en``'`, targetlanguage=None, unitclass=None) Constructs a blank TranslationStore. | source code

addheader(self) Method to be overridden to initialise headers, etc. | source code

namespaced(self, name) Returns name in Clark notation. | source code

initbody(self) Initialises self.body so it never needs to be retrieved from the XML again. | source code

TranslationUnit

addsourceunit(self, source) Adds and returns a new unit with the given string as first entry. | source code

addunit(self, unit, new=True) Appends the given unit to the object's list of units. | source code

__str__(self) Converts to a string containing the file's XML | source code

parse(self, xml) Populates this object from the given xml string | source code

Inherited from `base.TranslationStore`: `__getstate__`, `__setstate__`, `add_unit_to_index`, `detect_encoding`, `findid`, `findunit`, `findunits`, `getids`, `getprojectstyle`, `getsourcelanguage`, `gettargetlanguage`, `getunits`, `isempty`, `makeindex`, `remove_unit_from_index`, `require_index`, `save`, `savefile`, `setprojectstyle`, `setsourcelanguage`, `settargetlanguage`, `translate`, `unit_iter`

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

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]

| rootNode = ``'````'``
| bodyNode = ``'````'``
| XMLskeleton = ``'````'``
| namespace = `None` Parse an instance of this class from the start of the given string.
Inherited from `base.TranslationStore`: `Extensions`, `Mimetypes`, `Name`, `suggestions_in_format` Inherited from `base.TranslationStore` (private): `_binary`

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, inputfile=None, sourcelanguage=`'``en``'`, targetlanguage=None, unitclass=None)
(Constructor)

source code

Constructs a blank TranslationStore.

Overrides: object.__init__
  (inherited documentation)

### namespaced(self, name)

source code

Returns name in Clark notation.

For example namespaced("source") in an XLIFF document might return:

       {urn:oasis:names:tc:xliff:document:1.1}source

This is needed throughout lxml.

### addsourceunit(self, source)

source code

Adds and returns a new unit with the given string as first entry.

Returns: TranslationUnit
Overrides: base.TranslationStore.addsourceunit

### addunit(self, unit, new=True)

source code

Appends the given unit to the object's list of units.

This method should always be used rather than trying to modify the list manually.

Parameters:
  - `unit` - The unit that will be added.
Overrides: base.TranslationStore.addunit
  (inherited documentation)

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

source code

Converts to a string containing the file's XML

Overrides: object.__str__

### parse(self, xml)

source code

Populates this object from the given xml string

Overrides: base.TranslationStore.parse