Part of lp.translations.utilities.mozilla_zip View In Hierarchy
Known subclasses: lp.translations.utilities.mozilla_xpi_importer.MozillaZipImportParser, lp.translations.utilities.tests.test_mozilla_zip.TraversalRecorder
To traverse and process an XPI file, derive a class from this one and replace any hooks that you may need.
If an XPI manifest is provided, traversal will be restricted to directories it lists as containing localizable resources.
Method | __init__ | Open zip (or XPI, or jar) file and scan its contents. |
Method | _processEntry | Read one zip archive entry, figure out what to do with it. |
Method | _begin | Overridable hook: optional pre-traversal actions. |
Method | _processTranslatableFile | Overridable hook: process a file entry. |
Method | _processNestedJar | Overridable hook: handle a nested jar file. |
Method | _finish | Overridable hook: post-traversal actions. |
Parameters | filename | Name of this zip (XPI/jar) archive. |
archive | File-like object containing this zip archive. | |
xpi_path | Full path of this file inside the XPI archive. Leave out for the XPI archive itself. | |
manifest | XpiManifest representing the XPI archive's
manifest file, if any. |
Called only for files that may be localizable. If there is a manifest, that means the file must be in a location (or subtree) named by a "locale" entry.
Parameters | entry | Full name of file inside this zip archive, including path relative to the archive's root. |
locale_code | Code for locale this file belongs to, e.g. "en-US". | |
xpi_path | Full path of this file inside the XPI archive, e.g. "jar:locale/en-US.jar!/data/messages.dtd". | |
chrome_path | File's chrome path. This is a kind of "normalized" path used in XPI to describe a virtual directory hierarchy. The zip archive's actual layout (which the XPI paths describe) may be different. | |
filename_suffix | File name suffix or "extension" of the translatable file. This may be e.g. ".dtd" or ".xhtml," or the empty string if the filename does not contain a dot. |
Parameters | zip_instance | An instance of the same class as self, which has just parsed the nested jar file. |