start
Table of Contents

oo2po and po2oo

Convert between OpenOffice.org GSI/SDF files and the PO format. This tool provides a complete roundtrip; it preserves the structure of the GSI file and creates completly valid PO files.

Usage

oo2po [options] <sdf> <output>
po2oo [options] [-t <en-US.sdf>] -l <targetlang> <input> <sdf|output>

Where:

<sdf> is a valid OpenOffice.org GSI or SDF files
<output> is a directory for the resultant PO/POT files
<input> is a directory of translated PO files
<targetlang> is the ISO 639 language code used in the sdf file, eg. af

Options (oo2po):

--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 oo format
-xEXCLUDE, --exclude=EXCLUDE exclude names matching EXCLUDE from input paths
-oOUTPUT, --output=OUTPUT write to OUTPUT in po, pot 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)
-lLANG, --language=LANG set target language to extract from oo file (e.g. af-ZA)
--source-language=LANG set source language code (default en-US)
--nonrecursiveinput don’t treat the input oo as a recursive store
--duplicates=DUPLICATESTYLE what to do with duplicate strings (identical original text)
--multifile=MULTIFILESTYLE how to split po/pot files (single, toplevel or onefile)

Options (po2oo):

--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 po, pot formats
-xEXCLUDE, --exclude=EXCLUDE exclude names matching EXCLUDE from input paths
-oOUTPUT, --output=OUTPUT write to OUTPUT in oo format
-tTEMPLATE, --template=TEMPLATE read from TEMPLATE in oo format
--psyco=MODE use psyco to speed up the operation, modes: none, full, profile
-lLANG, --language=LANG set target language code (e.g. af-ZA) [required]
--source-language=LANG set source language code (default en-US)
-T, --keeptimestamp don’t change the timestamps of the strings
--nonrecursiveoutput don’t treat the output oo as a recursive store
--nonrecursivetemplate don’t treat the template oo as a recursive store
--filteraction=ACTION action on pofilter failure: none (default), warn, exclude-serious, exclude-all
--fuzzy use translations marked fuzzy
--nofuzzy don’t use translations marked fuzzy (default)
--multifile=MULTIFILESTYLE how to split po/pot files (single, toplevel or onefile)

Examples

These examples demonstrate most of the usefull invocations of oo2po:

Creating POT files

oo2po -P en-US.sdf pot

Extract messages from en-US.sdf and place them in a directory called pot. The -P option ensures that we create POT files instead of PO files.

oo2po -P --source-language=fr fr-FR.sdf french-pot

Instead of creating English POT files we are now creating POT files that contain French in the msgid. This is usefull for translators who are not English literate. You will need to have a fully translated sdf in the source language.

Creating PO files from existing work

oo2po --duplicates=merge -l zu zu-ZA.sdf zulu

Extract all existing Zulu (zu) messages from zu-ZA.sdf and place them in a direcotory called zulu. If you find duplicate messages in a file then merge them into a single message (This is the default behaviour for traditional PO files). You might want to use pomigrate2 to ensure that your PO files match the latest POT files.

cat GSI_af.sdf GSI_xh.sdf > GSI_af-xh.sdf
oo2po --source-language=af -l xh GSI_af-xh.sdf af-xh-po

Here we are creating PO files with your existing translations but a different source language. Firstly we combine the two SDF files. Then oo2po creates a set of PO files in af-xh-po using Afrikaans (af) as the source language and Xhosa (xh) as the target language from the combined SDF file GSI_af-xh.sdf

Creating a new GSI/SDF file

po2oo -l zu zulu zu_ZA.sdf

Using PO files found in zulu create an SDF files called zu_ZA.sdf for language zu

po2oo -l af -t en-US.sdf --nofuzzy --keeptimestamp --filteraction=exclude-serious afrikaans af_ZA.sdf

Create an Afrikaans (af) SDF file called af_ZA.sdf using en-US.sdf as a template and preserving the timestamps within the SDF file while also eliminating any serious errors in translation. Using templates ensures that the resultant SDF file has exactly the same format as the template SDF file. In an SDF file each translated string can have a timestamp attached. This creates a large amount of unusefull traffic when comparing version of the SDF file, by preserving the timestamp we ensure that this does not change and can therefore see the translation changes clearly. We have included the nofuzzy option (on by default) that prevent fuzzy PO messages from getting into the SDF file. Lastly the filteraction option is set to exclude serious errors: variables failures and translated XML will be excluded from the final SDF.

Bugs

- The “extracted from” line at the top of each file does not show the source file where the messages where extracted from

Expected:

# extracted from helpcontent2/source/text/shared/01.oo

Actual:

# extracted from

- In helpcontent2: The pot files created with trunk show \\\\n (4 backslashes and an n) where Pavel’s pot files (0.8rc5) have just 3 backslashes (\\\n). I’m not sure which one is expected.

- Sometimes the msgid start with an empty string on the first line. Example 1:

msgid ""
"Here be dragons."

Example 2:

msgid "Here be dragons."

- msgcat displays a space at the end of the first line. Expected msgcat behaviour:

msgid "Here be "
"dragons."

Actual trunk (r 5524) behaviour:

msgid "Here be"
" dragons."