Package translate :: Package storage :: Module properties :: Class propunit

[hide private]
[frames] | no frames]

# Class propunit

source code

an element of a properties file i.e. a name and value, and any comments associated

Instance Methods | [hide private]

__init__(self, source="", personality="java") construct a blank propunit | source code

_get_encoding(self) | source code

encoding(self) | source code

__str__(self) convert to a string. | source code

getoutput(self) convert the element back into formatted lines for a .properties file | source code

isblank(self) returns whether this is a blank element, containing only comments. | source code

istranslatable(self) Indicates whether this unit can be translated. | 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

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

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

Source

setsource(self, source) 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

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

gettarget(self) | source code

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") Adds a note (comment). | source code

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

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

Locations

List

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

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

Class Methods | [hide private]

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

Class Variables | [hide private]

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

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="", personality="java")
(Constructor)

source code

construct a blank propunit

Overrides: object.__init__

### setsource(self, source)

source code

Sets the source string to the given value.

Overrides: base.TranslationUnit.setsource
  (inherited documentation)

### settarget(self, target)

source code

Sets the target string to the given value.

Overrides: base.TranslationUnit.settarget
  (inherited documentation)

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

source code

convert to a string. double check that unicode is handled somehow here

Overrides: object.__str__

### getlocations(self)

source code

A list of source code locations.

Returns: List
Overrides: base.TranslationUnit.getlocations
  (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)

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

source code

Remove all the translator's notes.

Overrides: base.TranslationUnit.removenotes
  (inherited documentation)

### isblank(self)

source code

returns whether this is a blank element, containing only comments.

Overrides: base.TranslationUnit.isblank

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

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