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

[hide private]
[frames] | no frames]

# Class TranslationStore

source code

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

Nested Classes | [hide private]

| UnitClass The class of units that will be instantiated and used by this class

Instance Methods | [hide private]

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

getsourcelanguage(self) Gets the source language for this store | source code

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

gettargetlanguage(self) Gets the target 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

findid(self, id) find unit with matching id by checking id_index | source code

TranslationUnit or None

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

TranslationUnit or None

findunits(self, source) Finds the units with the given source string. | source code

String or None

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

remove_unit_from_index(self, unit) Remove a unit from source and locaton indexes | source code

add_unit_to_index(self, unit) Add a unit to source and location idexes | source code

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

require_index(self) make sure source index exists | source code

getids(self) return a list of unit ids | source code

__getstate__(self) | source code

__setstate__(self, dict) | 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]

| Name = ``'``Base translation store``'`` The human usable name of this store type
| Mimetypes = `None` A list of MIME types associated with this store type
| Extensions = `None` A list of file extentions associated with this store type
| _binary = `False` Indicates whether a file should be accessed as a binary file.
| suggestions_in_format = `False` Indicates if format can store suggestions and alternative translation for a unit

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__