Package translate :: Package storage :: Module lisa :: Class LISAfile
[hide private]
[frames] | no frames]

Class LISAfile

source code

           object --+    
                    |    
base.TranslationStore --+
                        |
                       LISAfile
Known Subclasses:

A class representing a file store for one of the LISA file formats.

Nested Classes [hide private]
  UnitClass
A single unit in the file.
Instance Methods [hide private]
 
__init__(self, inputfile=None, sourcelanguage='en', targetlanguage=None, unitclass=None)
Constructs a blank TranslationStore.
source code
 
addheader(self)
Method to be overridden to initialise headers, etc.
source code
 
namespaced(self, name)
Returns name in Clark notation.
source code
 
initbody(self)
Initialises self.body so it never needs to be retrieved from the XML again.
source code
TranslationUnit
addsourceunit(self, source)
Adds and returns a new unit with the given string as first entry.
source code
 
addunit(self, unit, new=True)
Appends the given unit to the object's list of units.
source code
 
__str__(self)
Converts to a string containing the file's XML
source code
 
parse(self, xml)
Populates this object from the given xml string
source code
 
setsourcelanguage(self, sourcelanguage)
Sets the source language for this store
 
settargetlanguage(self, targetlanguage)
Sets the target language for this store

Inherited from base.TranslationStore: findunit, getunits, isempty, makeindex, save, savefile, translate, unit_iter

Inherited from base.TranslationStore (private): _assignname

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

Class Methods [hide private]

Inherited from base.TranslationStore: parsefile, parsestring

Class Variables [hide private]
  rootNode = ''
  bodyNode = ''
  XMLskeleton = ''
  namespace = None

Inherited from base.TranslationStore: Extensions, Mimetypes

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, inputfile=None, sourcelanguage='en', targetlanguage=None, unitclass=None)
(Constructor)

source code 

Constructs a blank TranslationStore.

Overrides: object.__init__
(inherited documentation)

namespaced(self, name)

source code 
Returns name in Clark notation.

For example namespaced("source") in an XLIFF document might return
    {urn:oasis:names:tc:xliff:document:1.1}source
This is needed throughout lxml.

addsourceunit(self, source)

source code 

Adds and returns a new unit with the given string as first entry.

Returns: TranslationUnit
Overrides: base.TranslationStore.addsourceunit

addunit(self, unit, new=True)

source code 

Appends the given unit to the object's list of units.

This method should always be used rather than trying to modify the list manually.

Parameters:
  • unit - The unit that will be added.
Overrides: base.TranslationStore.addunit
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

Converts to a string containing the file's XML

Overrides: object.__str__

parse(self, xml)

source code 

Populates this object from the given xml string

Overrides: base.TranslationStore.parse

setsourcelanguage(self, sourcelanguage)

 

Sets the source language for this store

Overrides: base.TranslationStore.setsourcelanguage

settargetlanguage(self, targetlanguage)

 

Sets the target language for this store

Overrides: base.TranslationStore.settargetlanguage