start

# oo2po and po2oo

Convert between OpenOffice.org GSI/SDF files and the PO format. This tool provides a complete roundtrip while at the same preserving that structure of the GSI file and creating valid PO files, ie files that can use the Gettext tools.

## Usage

    oo2po [options] <sdf> <output>
    po2oo [options] <input> <output|sdf>

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

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 (set mode)
-P, --pot | output PO Templates (.pot) rather than PO files (.po)
-lLANG, --language=LANG | set 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 (set mode)
-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
--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 calle pot. The -P option ensures that we create POT files instead of PO files.

    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)

    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 -l xh GSI_xh.sdf xh-po

This will create Xhosa (xh) PO files from the existing Xhosa SDF file,GSI_xh.sdf , and place them in xh-po. 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 twp 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 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. 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 also included the nofuzzy option (on by default) that prevent fuzzy PO messages from getting into the SDF file.

## Bugs

Newlines \n and other escapes are double escaped ie \n appears as \\n. This does not affect the resultant GSI file but does mean that PO editing tools cannot intellegently handle linebreaks or checks for escapes.