Package translate :: Package storage :: Module ts2 :: Class tsunit

[hide private]
[frames] | no frames]

# Class tsunit

source code

A single term in the xliff file.

Instance Methods | [hide private]

createlanguageNode(self, lang, text, purpose) Returns an xml Element setup with given parameters. | source code

getlanguageNodes(self) We override this to get source and target nodes. | source code

hasplural(self) Tells whether or not this specific unit has plural strings. | source code

_gettype(self) Returns the type of this translation. | source code

_settype(self, value=None) Set the type of this translation. | source code

isreview(self) States whether this unit needs to be reviewed | source code

isfuzzy(self) Indicates whether this unit is fuzzy. | source code

markfuzzy(self, value=True) Marks the unit as fuzzy or not. | source code

string

getid(self) A unique identifier for this unit. | source code

istranslatable(self) Indicates whether this unit can be translated. | source code

getcontext(self) Get the message context. | source code

merge(self, otherunit, overwrite=False, comments=True, authoritative=False) Do basic format agnostic merging. | source code

isobsolete(self) indicate whether a unit is obsolete | source code

Inherited from `lisa.LISAunit`: `__eq__`, `__init__`, `__str__`, `createPHnodes`, `getNodeText`, `getlanguageNode`, `namespaced`

Inherited from `lisa.LISAunit` (private): `_set_property`

Inherited from `base.TranslationUnit`: `getunits`, `isblank`, `isheader`, `istranslated`, `makeobsolete`, `markreviewneeded`, `multistring_to_rich`, `setcontext`, `setid`, `unit_iter`

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

Source

_getsourcenode(self) | source code

getsource(self) | source code

Inherited from `lisa.LISAunit`: `get_source_dom`, `set_source_dom`, `setsource` Inherited from `base.TranslationUnit`: `getsourcelanguage` Inherited from `base.TranslationUnit` (private): `_get_rich_source`, `_set_rich_source`
Target

_gettargetnode(self) | source code

settarget(self, text) Sets the "target" string (second language), or alternatively appends to the list | source code

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

Inherited from `lisa.LISAunit`: `get_target_dom`, `set_target_dom`, `target_dom` Inherited from `base.TranslationUnit`: `gettargetlanguage`, `gettargetlen` Inherited from `base.TranslationUnit` (private): `_get_rich_target`, `_set_rich_target`
Notes

addnote(self, text, origin=None, position="append") Add a note specifically in a "comment" tag | source code

getnotes(self, origin=None) Returns all notes about this unit. | source code

removenotes(self, origin=None) Remove all the translator notes. | source code

Locations

addlocation(self, location) Add one location to the list of locations. | source code

List

getlocations(self) A list of source code locations. | source code

Inherited from `base.TranslationUnit`: `addlocations`
Errors
Inherited from `base.TranslationUnit`: `adderror`, `geterrors`

Class Methods | [hide private]

Inherited from `lisa.LISAunit`: `createfromxmlElement` Inherited from `base.TranslationUnit`: `buildfromunit`, `rich_to_multistring`

Class Variables | [hide private]

| rootNode = `"message"`
| languageNode = `"source"`
| textNode = `""`
| namespace = `''` Parse an instance of this class from the start of the given string.
| rich_parsers = ``[`<bound method type.regex_parse of <class 'tran`...`` A list of functions to use for parsing a string into a rich string tree.
Inherited from `lisa.LISAunit`: `rid`, `xid` Inherited from `lisa.LISAunit` (private): `_default_xml_space`
Source
| source = `property(getsource, lisa.LISAunit.setsource)`
| rich_source = `property(base.TranslationUnit._get_rich_source, `...``
Inherited from `lisa.LISAunit`: `source_dom`
Target
| target = `property(gettarget, settarget)`
| rich_target = `property(base.TranslationUnit._get_rich_target, `...``

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

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

source code

Returns an xml Element setup with given parameters.

Overrides: lisa.LISAunit.createlanguageNode

### getlanguageNodes(self)

source code

We override this to get source and target nodes.

Overrides: lisa.LISAunit.getlanguageNodes

### getsource(self)

source code

Overrides: lisa.LISAunit.getsource

### settarget(self, text)

source code

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

Overrides: base.TranslationUnit.settarget
  (inherited documentation)

### gettarget(self)

source code

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

Overrides: lisa.LISAunit.gettarget
  (inherited documentation)

### hasplural(self)

source code

Tells whether or not this specific unit has plural strings.

Overrides: base.TranslationUnit.hasplural
  (inherited documentation)

### addnote(self, text, origin=None, position="append")

source code

Add a note specifically in a "comment" tag

Parameters:
  - `text` - Usually just a sentence or two.
  - `origin` - Specifies who/where the comment comes from. Origin can be one of the following text strings:
    - 'translator'
    - 'developer', 'programmer', 'source code' (synonyms)
Overrides: base.TranslationUnit.addnote

### getnotes(self, origin=None)

source code

Returns all notes about this unit.

It will probably be freeform text or something reasonable that can be synthesised by the format. It should not include location comments (see getlocations()).

Overrides: base.TranslationUnit.getnotes
  (inherited documentation)

### removenotes(self, origin=None)

source code

Remove all the translator notes.

Overrides: base.TranslationUnit.removenotes

### isreview(self)

source code

States whether this unit needs to be reviewed

Overrides: base.TranslationUnit.isreview

### isfuzzy(self)

source code

Indicates whether this unit is fuzzy.

Overrides: base.TranslationUnit.isfuzzy
  (inherited documentation)

### markfuzzy(self, value=True)

source code

Marks the unit as fuzzy or not.

Overrides: base.TranslationUnit.markfuzzy
  (inherited documentation)

### getid(self)

source code

A unique identifier for this unit.

Returns: string
  an identifier for this unit that is unique in the store

  Derived classes should override this in a way that guarantees a unique identifier for each unit in the store.

Overrides: base.TranslationUnit.getid
  (inherited documentation)

### istranslatable(self)

source code

Indicates whether this unit can be translated.

This should be used to distinguish real units for translation from header, obsolete, binary or other blank units.

Overrides: base.TranslationUnit.istranslatable
  (inherited documentation)

### getcontext(self)

source code

Get the message context.

Overrides: base.TranslationUnit.getcontext
  (inherited documentation)

### addlocation(self, location)

source code

Add one location to the list of locations.

Overrides: base.TranslationUnit.addlocation
  (inherited documentation)

### getlocations(self)

source code

A list of source code locations.

Returns: List
Overrides: base.TranslationUnit.getlocations
  (inherited documentation)

### merge(self, otherunit, overwrite=False, comments=True, authoritative=False)

source code

Do basic format agnostic merging.

Overrides: base.TranslationUnit.merge
  (inherited documentation)

### isobsolete(self)

source code

indicate whether a unit is obsolete

Overrides: base.TranslationUnit.isobsolete
  (inherited documentation)

Class Variable Details | [hide private]

### rich_parsers

A list of functions to use for parsing a string into a rich string tree.

Value:

      [<bound method type.regex_parse of <class 'translate.storage.placeable
      s.general.NewlinePlaceable'>>,
       <bound method type.regex_parse of <class 'translate.storage.placeable
      s.general.XMLTagPlaceable'>>,
       <bound method type.regex_parse of <class 'translate.storage.placeable
      s.general.AltAttrPlaceable'>>,
       <bound method type.regex_parse of <class 'translate.storage.placeable
      s.general.XMLEntityPlaceable'>>,
      ...

### rich_source

See Also:
  rich_to_multistring, multistring_to_rich

Value:

      property(base.TranslationUnit._get_rich_source, base.TranslationUnit._
      set_rich_source)

### rich_target

See Also:
  rich_to_multistring, multistring_to_rich

Value:

      property(base.TranslationUnit._get_rich_target, base.TranslationUnit._
      set_rich_target)