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

[hide private]
[frames] | no frames]

# Class propunit

source code

              object --+
                       |
    base.TranslationUnit --+
                           |
                          propunit

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

Instance Methods | [hide private]

__init__(self, source=`'````'`) construct a blank propunit | 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

Inherited from `base.TranslationUnit`: `__eq__`, `getcontext`, `getid`, `getunits`, `hasplural`, `isfuzzy`, `isheader`, `isreview`, `istranslatable`, `istranslated`, `markfuzzy`, `markreviewneeded`, `merge`, `unit_iter` Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`
Source

setsource(self, source) Sets the source AND the target to be equal | source code

getsource(self) | source code

Inherited from `base.TranslationUnit`: `getsourcelanguage`
Target

settarget(self, target) Note: this also sets the .source attribute! | source code

gettarget(self) | source code

Inherited from `base.TranslationUnit`: `gettargetlanguage`, `gettargetlen`
Notes

addnote(self, note, origin=None) 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`

Properties | [hide private]

Inherited from `object`: `__class__`
Source
| source
Target
| target

Method Details | [hide private]

### __init__(self, source=`'````'`)
(Constructor)

source code

construct a blank propunit

Overrides: object.__init__

### settarget(self, target)

source code

Note: this also sets the .source attribute!

Overrides: base.TranslationUnit.settarget

### __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, note, origin=None)

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

Property Details | [hide private]

### source

Get Method:
  getsource(self)
Set Method:
  setsource(self, source) - Sets the source AND the target to be equal

### target

Get Method:
  gettarget(self)
Set Method:
  settarget(self, target) - Note: this also sets the .source attribute!