moz2po converts Mozilla XPI files to PO files. It wraps converters that handle .properties, .dtd, .xhtml and some strange Mozilla files. The tool can extract from an XPI file and build your complete XPI file from your PO files or work with files from Mozilla CVS. Thus providing a complete roundtrip for Mozilla localisation using PO files and PO editors.
moz2po [options] <xpi|dir> <po> po2moz [options] <po> <xpi|dir>
Options (moz2po):
--version | show program’s version number and exit |
-h, --help | show this help message and exit |
--manpage | output a manpage based on the help |
--progress=PROGRESS | show progress as: dots, none, bar, names, verbose |
--errorlevel=ERRORLEVEL | show errorlevel as: none, message, exception, traceback |
-iINPUT, --input=INPUT | read from INPUT in inc, it, *, dtd, properties formats |
-xEXCLUDE, --exclude=EXCLUDE | exclude names matching EXCLUDE from input paths |
-oOUTPUT, --output=OUTPUT | write to OUTPUT in it.po, it.pot, manifest, xhtml.po, xhtml.pot, ini.po, ini.pot, rdf, js, *, html.po, html.pot, inc.po, inc.pot, dtd.po, dtd.pot, properties.po, properties.pot formats |
-tTEMPLATE, --template=TEMPLATE | read from TEMPLATE in it, *, properties, dtd, inc formats |
--psyco=MODE | use psyco to speed up the operation, modes: none, full, profile |
-P, --pot | output PO Templates (.pot) rather than PO files (.po) |
--duplicates=DUPLICATESTYLE | what to do with duplicate strings (identical source text): merge (default), msgid_comment, keep, msgid_comment_all |
Options (po2moz):
--version | show program’s version number and exit |
-h, --help | show this help message and exit |
--manpage | output a manpage based on the help |
--progress=PROGRESS | show progress as: dots, none, bar, names, verbose |
--errorlevel=ERRORLEVEL | show errorlevel as: none, message, exception, traceback |
-iINPUT, --input=INPUT | read from INPUT in dtd.po, dtd.pot, ini.po, ini.pot, inc.po, inc.pot, manifest, it.po, it.pot, *, html.po, html.pot, js, rdf, properties.po, properties.pot, xhtml.po, xhtml.pot formats |
-xEXCLUDE, --exclude=EXCLUDE | exclude names matching EXCLUDE from input paths |
-oOUTPUT, --output=OUTPUT | write to OUTPUT in dtd, *, inc, it, properties formats |
-tTEMPLATE, --template=TEMPLATE | read from TEMPLATE in dtd, *, inc, it, properties formats |
--psyco=MODE | use psyco to speed up the operation, modes: none, full, profile |
-lLOCALE, --locale=LOCALE | set output locale (required as this sets the directory names) |
--clonexpi=CLONEXPI | clone xpi structure from the given xpi file |
--fuzzy | use translations marked fuzzy |
--nofuzzy | don’t use translations marked fuzzy (default) |
cd mozilla make -f tools/l10n/l10n.mk create-en-US cd .. moz2po -P l10n/en-US pot
First extract the correct en-US source files from Mozilla CVS, found in the mozilla directory, placing them in l10n/en-US. Then create a set of POT (-P) files in pot.
moz2po -P en-US.xpi pot
Creating set of POT (-P) files from the American English XPI, en-US.xpi and placing them in pot for use a PO Templates.
If you want to create a set of POT files with another base language try:
moz2po -P fr-FR.xpi fr-pot
This will create a set of POT files in fr-pot that have French as your source language.
cd mozilla make -f tools/l10n/l10n.mk create-en-US cd .. moz2po -t l10n/en-US l10n/xh po/xh
This is against Mozilla CVS. First create your en-US reference files. Then using moz2po take the template en-US files in l10n/en-US and merge them with translations in l10n/xh placing the PO files in po/xh. The text from en-US will appear in the msgid and the text from xh will appear in the msgstr. Run pocount to determine how much work you need to to to bring your translations up to fully translated.
moz2po -t l10n/fr l10n/xh po/xh
For those who are not English fluent you can do the same with another languages. In this case msgid will contain the French text from l10n/fr. This is useful for translating where the translators other languages is not English but French, Spanish or Portuguese. Please make sure that the source langauges i.e. the msgid language is fully translated as against en-US.
po2moz -lzu-ZA -t en-US.xpi zu zu-ZA.xpi
Create a Zulu language (-lzu-ZA) XPI called zu-ZA.xpi from translations found in zu using en-US.xpi as a template. We use a template to ensure that our DTD and .properties files appear exactly as those in en-US
po2moz -t l10n/en-US po/xh l10n/xh
Create Mozilla files using the templates files in l10n/en-US (see above for how to create them) with PO translations in po/xh and ouput then to l10n/xh. The files now in l10n/xh are ready for submission to Mozilla and can be used to build a language pack or translated version of Mozilla.
You can perform the bulk of your work (99%) with moz2po.
Localisation of XHTML is not yet perfect, you might want to work with the files directly.
This bug http://bugs.wordforge.org/show_bug.cgi?id=129 tracks the outstanding feature which would allow complete localisation of Mozilla including; all help, start pages, rdf files, etc. It also tracks some bugs.