Package horizons :: Package ext :: Module polib :: Class POFile
[hide private]
[frames] | no frames]

Class POFile

source code

object --+        
         |        
      list --+    
             |    
     _BaseFile --+
                 |
                POFile

Po (or Pot) file reader/writer. This class inherits the :class:`~polib._BaseFile` class and, by extension, the python ``list`` type.

Instance Methods [hide private]
 
__unicode__(self)
Returns the unicode representation of the po file.
source code
 
save_as_mofile(self, fpath)
Saves the binary representation of the file to given ``fpath``.
source code
 
percent_translated(self)
Convenience method that returns the percentage of translated messages.
source code
 
translated_entries(self)
Convenience method that returns the list of translated entries.
source code
 
untranslated_entries(self)
Convenience method that returns the list of untranslated entries.
source code
 
fuzzy_entries(self)
Convenience method that returns the list of fuzzy entries.
source code
 
obsolete_entries(self)
Convenience method that returns the list of obsolete entries.
source code
 
merge(self, refpot)
Convenience method that merges the current pofile with the pot file provided.
source code
    Inherited from _BaseFile
 
__contains__(self, entry)
Overriden ``list`` method to implement the membership test (in and not in).
source code
 
__eq__(self, other)
x==y
source code
new empty list
__init__(self, *args, **kwargs)
Constructor, accepts the following keyword arguments:
source code
 
__str__(self)
Returns the string representation of the file.
source code
 
_encode(self, mixed)
Encodes the given ``mixed`` argument with the file encoding if and only if it's an unicode string and returns the encoded string.
source code
 
append(self, entry)
Overriden method to check for duplicates entries, if a user tries to add an entry that is already in the file, the method will raise a ``ValueError`` exception.
source code
 
find(self, st, by='msgid', include_obsolete_entries=False, msgctxt=False)
Find the entry which msgid (or property identified by the ``by`` argument) matches the string ``st``.
source code
 
insert(self, index, entry)
Overriden method to check for duplicates entries, if a user tries to add an entry that is already in the file, the method will raise a ``ValueError`` exception.
source code
 
metadata_as_entry(self)
Returns the file metadata as a :class:`~polib.POFile` instance.
source code
 
ordered_metadata(self)
Convenience method that returns an ordered version of the metadata dictionary.
source code
 
save(self, fpath=None, repr_method='__unicode__')
Saves the po file to ``fpath``.
source code
 
to_binary(self)
Return the binary representation of the file.
source code
    Inherited from list
 
__add__(x, y)
x+y
 
__delitem__(x, y)
del x[y]
 
__delslice__(x, i, j)
del x[i:j]
 
__ge__(x, y)
x>=y
 
__getattribute__(...)
x.__getattribute__('name') <==> x.name
 
__getitem__(x, y)
x[y]
 
__getslice__(x, i, j)
x[i:j]
 
__gt__(x, y)
x>y
 
__iadd__(x, y)
x+=y
 
__imul__(x, y)
x*=y
 
__iter__(x)
iter(x)
 
__le__(x, y)
x<=y
 
__len__(x)
len(x)
 
__lt__(x, y)
x<y
 
__mul__(x, n)
x*n
 
__ne__(x, y)
x!=y
a new object with type S, a subtype of T
__new__(T, S, ...)
 
__repr__(x)
repr(x)
 
__reversed__(L)
return a reverse iterator over the list
 
__rmul__(x, n)
n*x
 
__setitem__(x, i, y)
x[i]=y
 
__setslice__(x, i, j, y)
x[i:j]=y
int
__sizeof__(L)
size of L in memory, in bytes
integer
count(L, value)
return number of occurrences of value
 
extend(L, iterable)
extend list by appending elements from the iterable
 
index(...)
L.index(value, [start, [stop]]) -> integer -- return first index of value.
item
pop(L, index=...)
remove and return item at index (default last).
 
remove(L, value)
remove first occurrence of value.
 
reverse(L)
reverse *IN PLACE*
 
sort(L, cmp=None, key=None, reverse=False)
stable sort *IN PLACE*; cmp(x, y) -> -1, 0, 1
    Inherited from object
 
__delattr__(...)
x.__delattr__('name') <==> del x.name
 
__format__(...)
default object formatter
 
__reduce__(...)
helper for pickle
 
__reduce_ex__(...)
helper for pickle
 
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
 
__subclasshook__(...)
Abstract classes can override this to customize issubclass().
Class Variables [hide private]
    Inherited from list
  __hash__ = None
hash(x)
Properties [hide private]
    Inherited from object
  __class__
the object's class
Method Details [hide private]

__unicode__(self)

source code 

Returns the unicode representation of the po file.

Overrides: _BaseFile.__unicode__

save_as_mofile(self, fpath)

source code 

Saves the binary representation of the file to given ``fpath``.

Keyword argument:

``fpath``
    string, full or relative path to the mo file.

merge(self, refpot)

source code 

Convenience method that merges the current pofile with the pot file
provided. It behaves exactly as the gettext msgmerge utility:

* comments of this file will be preserved, but extracted comments and
  occurrences will be discarded;
* any translations or comments in the file will be discarded, however,
  dot comments and file positions will be preserved;
* the fuzzy flags are preserved.

Keyword argument:

``refpot``
    object POFile, the reference catalog.