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 completely valid PO files.
oo2xliff will convert the SDF files to XLIFF format.
oo2po [options] <sdf> <output>
po2oo [options] [-t <en-US.sdf>] -l <targetlang> <input> <sdf|output>
or for XLIFF files:
oo2xliff [options] -l <targetlang> <sdf> <output>
xliff2oo [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/XLIFF files |
<input> |
is a directory of translated PO/XLIFF files |
<targetlang> |
is the ISO 639 language code used in the sdf file, e.g. af |
Options (oo2po and oo2xliff):
show program’s version number and exit
show this help message and exit
output a manpage based on the help
show progress as: dots, none, bar, names, verbose
show errorlevel as: none, message, exception, traceback
read from INPUT in oo, sdf formats
exclude names matching EXCLUDE from input paths
write to OUTPUT in po, pot, xlf formats
skip conversion if the output file has newer timestamp
output PO Templates (.pot) rather than PO files (.po) (only available in oo2po
set target language to extract from oo file (e.g. af-ZA) (required for oo2xliff)
set source language code (default en-US)
don’t treat the input oo as a recursive store
what to do with duplicate strings (identical source text): merge, msgctxt (default: ‘msgctxt’)
how to split po/pot files (single, toplevel or onefile)
Options (po2oo and xliff2oo):
show program’s version number and exit
show this help message and exit
output a manpage based on the help
show progress as: dots, none, bar, names, verbose
show errorlevel as: none, message, exception, traceback
read from INPUT in po, pot, xlf formats
exclude names matching EXCLUDE from input paths
write to OUTPUT in oo, sdf formats
read from TEMPLATE in oo, sdf formats
skip conversion if the output file has newer timestamp
set target language code (e.g. af-ZA) [required]
set source language code (default en-US)
don’t change the timestamps of the strings
don’t treat the output oo as a recursive store
don’t treat the template oo as a recursive store
don’t output the source language, but fallback to it where needed
action on pofilter failure: none (default), warn, exclude-serious, exclude-all
only convert files where the translation completion is above PERCENT
use translations marked fuzzy
don’t use translations marked fuzzy (default)
how to split po/pot files (single, toplevel or onefile)
These examples demonstrate most of the useful invocations of oo2po:
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 useful for translators who are not English literate. You will need to have a fully translated sdf in the source language.
oo2po --duplicates=merge -l zu zu-ZA.sdf zulu
Extract all existing Zulu (zu) messages from zu-ZA.sdf and place them in a directory 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
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 unuseful 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.
The escaping of helpcontent2
from SDF files was very confusing,
issue 295 implemented a fix that appeared in version 1.1.0 (All known issues
were fixed in 1.1.1). Translators are now able to translate helpcontent2 with
clean escaping.