Package translate :: Package storage :: Module csvl10n :: Class csvunit

[hide private]
[frames] | no frames]

# Class csvunit

source code

Instance Methods | [hide private]

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

string

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

setid(self, value) Sets the unique identified for this unit. | source code

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

setcontext(self, value) Set the message context | 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

match_header(self) see if unit might be a header | source code

add_spreadsheet_escapes(self, source, target) add common spreadsheet escapes to two strings | source code

remove_spreadsheet_escapes(self, source, target) remove common spreadsheet escapes from two strings | source code

fromdict(self, cedict, encoding='utf-8') | source code

todict(self, encoding='utf-8') | source code

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

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

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

Source
Inherited from `base.TranslationUnit`: `getsourcelanguage`, `setsource` Inherited from `base.TranslationUnit` (private): `_get_rich_source`, `_set_rich_source`
Target
Inherited from `base.TranslationUnit`: `gettargetlanguage`, `gettargetlen`, `settarget` Inherited from `base.TranslationUnit` (private): `_get_rich_target`, `_set_rich_target`
Notes

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

addnote(self, text, origin=None, position="append") Adds a note (comment). | source code

removenotes(self) Remove all the translator's notes. | source code

Locations

List

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

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

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

Class Methods | [hide private]

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

Class Variables | [hide private]

| spreadsheetescapes = `[("+", "\\+"), ("-", "\\-"), ("=", "\\=")`...``
Inherited from `base.TranslationUnit`: `STATE`, `S_EMPTY`, `S_FINAL`, `S_NEEDS_REVIEW`, `S_NEEDS_WORK`, `S_OBSOLETE`, `S_REJECTED`, `S_UNREVIEWED`, `rich_parsers`

Properties | [hide private]

Inherited from `base.TranslationUnit`: `rid`, `xid` Inherited from `object`: `__class__`
Source
Inherited from `base.TranslationUnit`: `rich_source`, `source`
Target
Inherited from `base.TranslationUnit`: `rich_target`, `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)

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

### setid(self, value)

source code

Sets the unique identified for this unit.

only implemented if format allows ids independant from other unit properties like source or context

Overrides: base.TranslationUnit.setid
  (inherited documentation)

### getlocations(self)

source code

A list of source code locations.

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

### addlocation(self, location)

source code

Add one location to the list of locations.

Overrides: base.TranslationUnit.addlocation
  (inherited documentation)

### getcontext(self)

source code

Get the message context.

Overrides: base.TranslationUnit.getcontext
  (inherited documentation)

### setcontext(self, value)

source code

Set the message context

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

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

source code

Adds a note (comment).

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
  (inherited documentation)

### removenotes(self)

source code

Remove all the translator's notes.

Overrides: base.TranslationUnit.removenotes
  (inherited documentation)

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

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

### spreadsheetescapes

Value:

      [("+", "\\+"), ("-", "\\-"), ("=", "\\="), ("'", "\\'")]