Package translate :: Package storage :: Module lisa :: Class LISAunit

[hide private]
[frames] | no frames]

# Class LISAunit

source code

              object --+
                       |
    base.TranslationUnit --+
                           |
                          LISAunit

Known Subclasses:
  - xliff.xliffunit
  - , ts2.tsunit
  - , tbx.tbxunit
  - , qph.QphUnit
  - , tmx.tmxunit

A single unit in the file. Provisional work is done to make several languages possible.

Instance Methods | [hide private]

__init__(self, source, empty=False) Constructs a unit containing the given source string | source code

Boolean

__eq__(self, other) Compares two units | source code

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

createlanguageNode(self, lang, text, purpose=None) Returns a xml Element setup with given parameters to represent a single language entry. | source code

createPHnodes(self, parent, text) Create the text node in parent containing all the ph tags | source code

getlanguageNodes(self) Returns a list of all nodes that contain per language information. | source code

getlanguageNode(self, lang=None, index=None) Retrieves a languageNode either by language or by index | source code

getNodeText(self, languageNode) Retrieves the term from the given languageNode | source code

__str__(self) str(x) | source code

Inherited from `base.TranslationUnit`: `getcontext`, `getid`, `getunits`, `hasplural`, `isblank`, `isfuzzy`, `isheader`, `isreview`, `istranslatable`, `istranslated`, `markfuzzy`, `markreviewneeded`, `merge`, `unit_iter` Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`
Source

setsource(self, text, sourcelang=`'``en``'`) | source code

getsource(self) | source code

Inherited from `base.TranslationUnit`: `getsourcelanguage`
Target

settarget(self, text, lang=`'``xx``'`, append=False) Sets the "target" string (second language), or alternatively appends to the list | source code

gettarget(self, lang=None) retrieves the "target" text (second entry), or the entry in the specified language, if it exists | source code

Inherited from `base.TranslationUnit`: `gettargetlanguage`, `gettargetlen`
Notes
Inherited from `base.TranslationUnit`: `addnote`, `getnotes`, `removenotes`
Locations
Inherited from `base.TranslationUnit`: `addlocation`, `addlocations`, `getlocations`
Errors
Inherited from `base.TranslationUnit`: `adderror`, `geterrors`

Class Methods | [hide private]

createfromxmlElement(cls, element) |

Inherited from `base.TranslationUnit`: `buildfromunit`

Class Variables | [hide private]

| rootNode = ``'````'``
| languageNode = ``'````'``
| textNode = ``'````'``
| namespace = `None`

Properties | [hide private]

Inherited from `object`: `__class__`
Source
| source
Target
| target retrieves the "target" text (second entry), or the entry in the specified language, if it exists

Method Details | [hide private]

### __init__(self, source, empty=False)
(Constructor)

source code

Constructs a unit containing the given source string

Overrides: object.__init__

### __eq__(self, other)
(Equality operator)

source code

Compares two units

Parameters:
  - `other` - Another TranslationUnit
Returns: Boolean
  Returns True if the supplied TranslationUnit equals this unit.
Overrides: base.TranslationUnit.__eq__

### 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.

### settarget(self, text, lang=`'``xx``'`, append=False)

source code

Sets the "target" string (second language), or alternatively appends to the list

Overrides: base.TranslationUnit.settarget

### createlanguageNode(self, lang, text, purpose=None)

source code

Returns a xml Element setup with given parameters to represent a single language entry. Has to be overridden.

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

source code

str(x)

Overrides: object.__str__
  (inherited documentation)

Property Details | [hide private]

### source

Get Method:
  getsource(self)
Set Method:
  setsource(self, text, sourcelang=`'``en``'`)

### target

retrieves the "target" text (second entry), or the entry in the specified language, if it exists

Get Method:
  gettarget(self, lang=None) - retrieves the "target" text (second entry), or the entry in the specified language, if it exists
Set Method:
  settarget(self, text, lang=`'``xx``'`, append=False) - Sets the "target" string (second language), or alternatively appends to the list