Package translate :: Package storage :: Module poxliff :: Class PoXliffUnit
[hide private]
[frames] | no frames]

Class PoXliffUnit

source code

          object --+            
                   |            
base.TranslationUnit --+        
                       |        
           lisa.LISAunit --+    
                           |    
             xliff.xliffunit --+
                               |
                              PoXliffUnit

A class to specifically handle the plural units created from a po file.

Instance Methods [hide private]
 
__init__(self, source, empty=False)
Constructs a unit containing the given source string
source code
Boolean
__eq__(self, other)
Compares two units
source code
 
markfuzzy(self, value=True)
Marks the unit as fuzzy or not.
source code
 
marktranslated(self) source code
 
setid(self, id) source code
 
getautomaticcomments(self)
Returns the automatic comments (x-po-autocomment), which corresponds to the #.
source code
 
gettranslatorcomments(self)
Returns the translator comments (x-po-trancomment), which corresponds to the # style po comments.
source code
 
isheader(self)
Indicates whether this unit is a header.
source code
 
hasplural(self)
Tells whether or not this specific unit has plural strings.
source code

Inherited from xliff.xliffunit: addalttrans, correctorigin, createcontextgroup, createlanguageNode, delalttrans, getalttrans, getcontextgroups, getid, getlanguageNodes, getrestype, isapproved, isfuzzy, isreview, istranslatable, markapproved, markreviewneeded, merge

Inherited from lisa.LISAunit: __str__, createPHnodes, getNodeText, getlanguageNode, namespaced

Inherited from base.TranslationUnit: getcontext, getunits, isblank, istranslated, unit_iter

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

    Source
 
setsource(self, source, sourcelang='en') source code
 
getsource(self) source code

Inherited from base.TranslationUnit: getsourcelanguage

    Target
 
settarget(self, text, lang='xx', append=False)
Sets the target string to the given value.
source code
 
gettarget(self)
retrieves the "target" text (second entry), or the entry in the specified language, if it exists
source code

Inherited from base.TranslationUnit: gettargetlanguage, gettargetlen

    Notes
 
addnote(self, text, origin=None)
Add a note specifically in a "note" tag
source code
 
getnotes(self, origin=None)
Returns all notes about this unit.
source code

Inherited from xliff.xliffunit: getnotelist, removenotes

    Locations
List
getlocations(self)
Returns all the references (source locations)
source code

Inherited from xliff.xliffunit: addlocation

Inherited from base.TranslationUnit: addlocations

    Errors

Inherited from xliff.xliffunit: adderror, geterrors

Class Methods [hide private]
 
createfromxmlElement(cls, element, namespace=None) source code

Inherited from base.TranslationUnit: buildfromunit

Class Variables [hide private]

Inherited from xliff.xliffunit: languageNode, namespace, rootNode, textNode

Properties [hide private]

Inherited from object: __class__

    Source
  source
    Target
  target
retrieves the "target" text (second entry), or the entry in the specified language, if it exists
Method Details [hide private]

__init__(self, source, empty=False)
(Constructor)

source code 

Constructs a unit containing the given source string

Overrides: object.__init__
(inherited documentation)

__eq__(self, other)
(Equality operator)

source code 

Compares two units

Parameters:
Returns: Boolean
Returns True if the supplied TranslationUnit equals this unit.
Overrides: base.TranslationUnit.__eq__
(inherited documentation)

setsource(self, source, sourcelang='en')

source code 
Overrides: lisa.LISAunit.setsource

getsource(self)

source code 
Overrides: lisa.LISAunit.getsource

settarget(self, text, lang='xx', append=False)

source code 

Sets the target string to the given value.

Overrides: base.TranslationUnit.settarget
(inherited documentation)

gettarget(self)

source code 

retrieves the "target" text (second entry), or the entry in the specified language, if it exists

Overrides: lisa.LISAunit.gettarget
(inherited documentation)

addnote(self, text, origin=None)

source code 

Add a note specifically in a "note" tag

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

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)

markfuzzy(self, value=True)

source code 

Marks the unit as fuzzy or not.

Overrides: base.TranslationUnit.markfuzzy
(inherited documentation)

marktranslated(self)

source code 
Overrides: xliff.xliffunit.marktranslated

setid(self, id)

source code 
Overrides: xliff.xliffunit.setid

getlocations(self)

source code 

Returns all the references (source locations)

Returns: List
Overrides: base.TranslationUnit.getlocations

getautomaticcomments(self)

source code 

Returns the automatic comments (x-po-autocomment), which corresponds to the #. style po comments.

isheader(self)

source code 

Indicates whether this unit is a header.

Overrides: base.TranslationUnit.isheader
(inherited documentation)

createfromxmlElement(cls, element, namespace=None)
Class Method

source code 
Overrides: lisa.LISAunit.createfromxmlElement

hasplural(self)

source code 

Tells whether or not this specific unit has plural strings.

Overrides: base.TranslationUnit.hasplural
(inherited documentation)

Property Details [hide private]

source

Get Method:
getsource(self)
Set Method:
setsource(self, source, sourcelang='en')

target

retrieves the "target" text (second entry), or the entry in the specified language, if it exists

Get Method:
gettarget(self) - retrieves the "target" text (second entry), or the entry in the specified language, if it exists
Set Method:
settarget(self, text, lang='xx', append=False) - Sets the target string to the given value.