Package translate :: Package storage :: Module catkeys :: Class CatkeysUnit

[hide private]
[frames] | no frames]

# Class CatkeysUnit

source code

A catkeys translation memory unit

Instance Methods | [hide private]

__init__(self, source=None) Constructs a TranslationUnit containing the given source string. | source code

getdict(self) Get the dictionary of values for a catkeys line | source code

setdict(self, newdict) Set the dictionary of values for a catkeys line | source code

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

string

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

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

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

istranslated(self) Indicates whether this unit is translated. | source code

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

Inherited from `base.TranslationUnit`: `__eq__`, `get_state_id`, `get_state_n`, `getunits`, `hasplural`, `infer_state`, `isblank`, `isfuzzy`, `isheader`, `isobsolete`, `isreview`, `istranslatable`, `makeobsolete`, `markreviewneeded`, `multistring_to_rich`, `set_state_n`, `setcontext`, `setid`, `unit_iter`

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

Source

_get_source_or_target(self, key) | source code

_set_source_or_target(self, key, newvalue) | source code

getsource(self) | source code

setsource(self, newsource) Sets the source string to the given value. | source code

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

gettarget(self) | source code

settarget(self, newtarget) Sets the target string to the given value. | source code

settargetlang(self, newlang) | source code

Inherited from `base.TranslationUnit`: `gettargetlanguage`, `gettargetlen` Inherited from `base.TranslationUnit` (private): `_get_rich_target`, `_set_rich_target`
Notes

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

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

Class Methods | [hide private]

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

Class Variables | [hide private]

| dict = `property(getdict, setdict)`
Inherited from `base.TranslationUnit`: `STATE`, `S_EMPTY`, `S_FINAL`, `S_NEEDS_REVIEW`, `S_NEEDS_WORK`, `S_OBSOLETE`, `S_REJECTED`, `S_UNREVIEWED`, `rich_parsers`
Source
| source = `property(getsource, setsource)`
Target
| target = `property(gettarget, settarget)`
| targetlang = `property(None, settargetlang)`

Properties | [hide private]

Inherited from `base.TranslationUnit`: `rid`, `xid` Inherited from `object`: `__class__`
Source
Inherited from `base.TranslationUnit`: `rich_source`
Target
Inherited from `base.TranslationUnit`: `rich_target`

Method Details | [hide private]

### __init__(self, source=None)
(Constructor)

source code

Constructs a TranslationUnit containing the given source string.

Overrides: object.__init__
  (inherited documentation)

### setdict(self, newdict)

source code

Set the dictionary of values for a catkeys line

Parameters:
  - `newdict` (Dict) - a new dictionary with catkeys line elements

### setsource(self, newsource)

source code

Sets the source string to the given value.

Overrides: base.TranslationUnit.setsource
  (inherited documentation)

### settarget(self, newtarget)

source code

Sets the target string to the given value.

Overrides: base.TranslationUnit.settarget
  (inherited documentation)

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

### getcontext(self)

source code

Get the message context.

Overrides: base.TranslationUnit.getcontext
  (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)

### markfuzzy(self, present=True)

source code

Marks the unit as fuzzy or not.

Overrides: base.TranslationUnit.markfuzzy
  (inherited documentation)

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

source code

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

Overrides: object.__str__
  (inherited documentation)

### istranslated(self)

source code

Indicates whether this unit is translated.

This should be used rather than deducing it from .target, to ensure that other classes can implement more functionality (as XLIFF does).

Overrides: base.TranslationUnit.istranslated
  (inherited documentation)

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

source code

Do basic format agnostic merging.

Overrides: base.TranslationUnit.merge