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

Class MOFile

source code

object --+        
         |        
      list --+    
             |    
     _BaseFile --+
                 |
                MOFile

Mo file reader/writer. This class inherits the :class:`~polib._BaseFile` class and, by extension, the python ``list`` type.

Instance Methods [hide private]
new empty list
__init__(self, *args, **kwargs)
Constructor, accepts all keywords arguments accepted by :class:`~polib._BaseFile` class.
source code
 
save_as_pofile(self, fpath)
Saves the mofile as a pofile to ``fpath``.
source code
 
save(self, fpath=None)
Saves the mofile to ``fpath``.
source code
 
percent_translated(self)
Convenience method to keep the same interface with POFile instances.
source code
 
translated_entries(self)
Convenience method to keep the same interface with POFile instances.
source code
 
untranslated_entries(self)
Convenience method to keep the same interface with POFile instances.
source code
 
fuzzy_entries(self)
Convenience method to keep the same interface with POFile instances.
source code
 
obsolete_entries(self)
Convenience method to keep the same interface with POFile instances.
source code

Inherited from list: __add__, __delitem__, __delslice__, __ge__, __getattribute__, __getitem__, __getslice__, __gt__, __iadd__, __imul__, __iter__, __le__, __len__, __lt__, __mul__, __ne__, __new__, __repr__, __reversed__, __rmul__, __setitem__, __setslice__, __sizeof__, count, extend, index, pop, remove, reverse, sort

Inherited from object: __delattr__, __format__, __reduce__, __reduce_ex__, __setattr__, __subclasshook__

    Inherited from _BaseFile
 
__contains__(self, entry)
Overridden ``list`` method to implement the membership test (in and not in).
source code
 
__eq__(self, other)
x==y
source code
 
__str__(self)
Returns the string representation of the file.
source code
 
__unicode__(self)
Returns the unicode 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)
Overridden 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)
Overridden 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
 
to_binary(self)
Return the binary representation of the file.
source code
Class Variables [hide private]
  MAGIC = 2500072158
  MAGIC_SWAPPED = 3725722773

Inherited from list: __hash__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, *args, **kwargs)
(Constructor)

source code 

Constructor, accepts all keywords arguments accepted by :class:`~polib._BaseFile` class.

Returns: new empty list
Overrides: object.__init__

save_as_pofile(self, fpath)

source code 

Saves the mofile as a pofile to ``fpath``.

Keyword argument:

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

save(self, fpath=None)

source code 

Saves the mofile to ``fpath``.

Keyword argument:

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

Overrides: _BaseFile.save