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
 
__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, multistring_to_rich, 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, rich_to_multistring

Class Variables [hide private]

Inherited from base.TranslationUnit: rich_parsers

Properties [hide private]

Inherited from base.TranslationUnit: rid, xid

Inherited from object: __class__

    Source
  source

Inherited from base.TranslationUnit: rich_source

    Target
  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 AND the target to be equal

Overrides: base.TranslationUnit.setsource

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!