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

[hide private]
[frames] | no frames]

# Class LISAunit

source code

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

Instance Methods | [hide private]

__init__(self, source, empty=False, **kwargs) 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, xml_space=`'``preserve``'`) Retrieves the term from the given languageNode | source code

__str__(self) Converts to a string representation that can be parsed back using `parsestring()`. | source code

_set_property(self, name, value) | source code

Inherited from `base.TranslationUnit`: `getcontext`, `getid`, `getunits`, `hasplural`, `isblank`, `isfuzzy`, `isheader`, `isobsolete`, `isreview`, `istranslatable`, `istranslated`, `makeobsolete`, `markfuzzy`, `markreviewneeded`, `merge`, `multistring_to_rich`, `setcontext`, `setid`, `unit_iter`

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

Source

set_source_dom(self, dom_node) | source code

get_source_dom(self) | source code

setsource(self, text, sourcelang=`'``en``'`) Sets the source string to the given value. | source code

getsource(self) | source code

Inherited from `base.TranslationUnit`: `getsourcelanguage` Inherited from `base.TranslationUnit` (private): `_get_rich_source`, `_set_rich_source`
Target

set_target_dom(self, dom_node, append=False) | source code

get_target_dom(self, lang=None) | source code

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` Inherited from `base.TranslationUnit` (private): `_get_rich_target`, `_set_rich_target`
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) | source code

Inherited from `base.TranslationUnit`: `buildfromunit`, `rich_to_multistring`

Class Variables | [hide private]

| rootNode = ``'````'``
| languageNode = ``'````'``
| textNode = ``'````'``
| namespace = `None` Parse an instance of this class from the start of the given string.
| _default_xml_space = ``'``preserve``'`` The default handling of spacing in the absense of an xml:space attribute.
Inherited from `base.TranslationUnit`: `rich_parsers`

Properties | [hide private]

| xid xid
| rid rid
Inherited from `object`: `__class__`
Source
| source_dom
| source
Inherited from `base.TranslationUnit`: `rich_source`
Target
| target_dom
| target retrieves the "target" text (second entry), or the entry in the specified language, if it exists
Inherited from `base.TranslationUnit`: `rich_target`

Method Details | [hide private]

### __init__(self, source, empty=False, **kwargs)
(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.

### setsource(self, text, sourcelang=`'``en``'`)

source code

Sets the source string to the given value.

Overrides: base.TranslationUnit.setsource
  (inherited documentation)

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

Converts to a string representation that can be parsed back using `parsestring()`.

Overrides: object.__str__
  (inherited documentation)

Class Variable Details | [hide private]

### _default_xml_space

The default handling of spacing in the absense of an xml:space attribute.

This is mostly for correcting XLIFF behaviour.

Value:

      'preserve'

Property Details | [hide private]

### source_dom

Get Method:
  get_source_dom(self)
Set Method:
  set_source_dom(self, dom_node)

### source

Get Method:
  getsource(self)
Set Method:
  setsource(self, text, sourcelang=`'``en``'`) - Sets the source string to the given value.

### target_dom

Get Method:
  get_target_dom(self, lang=None)

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

### xid

xid

Get Method:
  unreachable(self) - xid
Set Method:
  unreachable(self, value) - xid

### rid

rid

Get Method:
  unreachable(self) - rid
Set Method:
  unreachable(self, value) - rid