Package Pootle :: Package storage :: Module api :: Class ITranslationStore
[show private | hide private]
[frames | no frames]

Type ITranslationStore

 object --+        
          |        
  Interface --+    
              |    
   IAnnotatable --+
                  |
 object --+       |
          |       |
  Interface --+   |
              |   |
IHaveStatistics --+
                  |
 object --+       |
          |       |
  Interface --+   |
              |   |
    ISearchable --+
                  |
                 ITranslationStore


A collection of translation units

This loosely corresponds to a .po file.

Note that the internal container of translation units is not exposed directly so that the implementation can accurately track all changes.

For efficiency reasons modifications are not recorded immediately. Call save() explicitly when you are done modifying the data.
Method Summary
  __getitem__(self, number)
Get translation by index (starting from 0).
  __getslice__(self, start, end)
Return a half-open range (by number) of translations.
  __iter__(self)
Return an iterable of translation units.
  __len__(self)
  fill(self, units)
Clear this store and import list of units from given iterable.
  makeunit(self, trans)
Construct a new translation unit.
  save(self)
Save the current state of this store to persistent storage.
  translate(self, source, plural)
Translate the given source message.
    Inherited from IHaveStatistics
  statistics(self)
Return statistics for this object.
    Inherited from ISearchable
  find(self, substring)
Search for a substring in all translation units.
    Inherited from object
  __init__(...)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
x.__repr__() <==> repr(x)
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Class Variable Summary
type header = Pootle.storage.api.IHeader
type key = Pootle.storage.api.String
type langinfo = Pootle.storage.api.ILanguageInfo
type module = Pootle.storage.api.IModule
    Inherited from IAnnotatable
NoneType annotations = None                                                                  

Method Details

__getitem__(self, number)
(Indexing operator)

Get translation by index (starting from 0).

__getslice__(self, start, end)
(Slicling operator)

Return a half-open range (by number) of translations.

This allows slice-notation: store[0:5] would get the first 5 units.

__iter__(self)

Return an iterable of translation units.

fill(self, units)

Clear this store and import list of units from given iterable.

makeunit(self, trans)

Construct a new translation unit.

Only put units constructed by this method inside this store.

trans is a list of tuples (source, target). `source` and `target` should be unicode values. Target may be None.

save(self)

Save the current state of this store to persistent storage.

translate(self, source, plural=0)

Translate the given source message.

If a plural is requested, its index must be provided.

Raises ValueError if source is not found.

Generated by Epydoc 2.1 on Tue Aug 22 04:29:46 2006 http://epydoc.sf.net