Package translate :: Package storage :: Module base :: Class TranslationStore

[hide private]
[frames] | no frames]

# Class TranslationStore

source code

    object --+
             |
            TranslationStore

Known Subclasses:
  - pocommon.pofile
  - , lisa.LISAfile
  - , properties.propfile
  - , csvl10n.csvfile
  - , php.phpfile
  - , ini.inifile
  - , mo.mofile
  - , wordfast.WordfastTMFile
  - , txt.TxtFile
  - , qm.qmfile
  - , dtd.dtdfile
  - , odf.ODFFile
  - , html.htmlfile
  - , rc.rcfile

Base class for stores for multiple translation units of type UnitClass.

Nested Classes | [hide private]

| UnitClass Base class for translation units.

Instance Methods | [hide private]

__init__(self, unitclass=None) Constructs a blank TranslationStore. | source code

setsourcelanguage(self, sourcelanguage) Sets the source language for this store | source code

settargetlanguage(self, targetlanguage) Sets the target language for this store | source code

unit_iter(self) Iterator over all the units in this store. | source code

getunits(self) Return a list of all units in this store. | source code

addunit(self, unit) Appends the given unit to the object's list of units. | source code

TranslationUnit

addsourceunit(self, source) Adds and returns a new unit with the given source string. | source code

TranslationUnit or None

findunit(self, source) Finds the unit with the given source string. | source code

String or None

translate(self, source) Returns the translated string for a given source string. | source code

makeindex(self) Indexes the items in this store. | source code

__str__(self) Converts to a string representation that can be parsed back using parsestring(). | source code

isempty(self) Returns True if the object doesn't contain any translation units. | source code

_assignname(self) Tries to work out what the name of the filesystem file is and assigns it to .filename. | source code

parse(self, data) parser to process the given source string | source code

savefile(self, storefile) Writes the string representation to the given file (or filename). | source code

save(self) Save to the file that data was originally read from, if available. | source code

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

Class Methods | [hide private]

parsestring(cls, storestring) Converts the string representation back to an object. |

parsefile(cls, storefile) Reads the given file (or opens the given filename) and parses back to an object. |

Class Variables | [hide private]

| Mimetypes = `None`
| Extensions = `None`

Properties | [hide private]

Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, unitclass=None)
(Constructor)

source code

Constructs a blank TranslationStore.

Overrides: object.__init__

### addunit(self, unit)

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` (TranslationUnit) - The unit that will be added.

### makeindex(self)

source code

Indexes the items in this store. At least .sourceindex should be usefull.

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

source code

Converts to a string representation that can be parsed back using parsestring().

Overrides: object.__str__