Tips&Tricks

From The Document Foundation Wiki
Jump to: navigation, search
Audio-cassette.png This page (may) contain content that is old and/or out of date.

If you have experience in this area, please review this page for accuracy. Reason: LibreOffice doesn’t even use .sdf files anymore.

Checking your files with GSIcheck

GSIcheck is a tool that will check for several consistencies in your files before they will be committed to the sources and it will prevent build breakage. Andras is checking the files before committing them, but we can help him by doing so with our files.

You can do most of the steps that are described here with this script: Check sdf.sh.tgz. The script requires translate toolkit and gsicheck to be installed. Change the variable declarations in the first script lines according to your requirements.

Getting the sdf file

First you have to convert your .po files to an .sdf file containing your translation.

  • download the .po files on Pootle: go under the Translate tab and click on Zip of directory at the top of the page.
  • download the sdf file corresponding to the pot file (should be the same as your file on Pootle, just check that the POT-Creation-Date: in the header of your files is the same as on the sdf), the last sdf file available should be the good one.
  • put the help files in the UI directory under the helpcontent2/source/text directory, otherwise, the script won't generate the .sdf correctly.
  • use the following to generate the .sdf file for your translation
po2oo -t template-en-US.sdf -l xx libo33x_ui-xx newxx.sdf

where template-en-US.sdf is the last template .sdf file, -l xx is your language code, libo33x_ui-xx is the directory containing all the .po files (remember to add the help files) and newxx.sdf is the new .sdf file that will be generated and containing the strings in your language.

Getting the last version of GSICheck

The files are available on the OpenOffice.org services respository.

Running GSICheck

Once you've download GSIcheck, just unzip it. To use it, enter in the directory:

./gsicheck newxx.sdf

the available commands are:

gsicheck Version 1.9.0 (c)1999 - 2006 by SUN Microsystems
=========================================================    
gsicheck checks the syntax of tags in GSI-Files and SDF-Files           
 checks for inconsistencies and malicious UTF8 encoding                    
 checks tags in Online Help             
Syntax:  
gsicheck [ -c ] [-f] [ -we ] [ -wef ErrorFilename ] [ -wc ] [ -wcf CorrectFilename ] [ -s | -t ] [ -l LanguageID ] [ -r ReferenceFile ] filename    
-c Add context to error message (Print the line containing the error)      
-f try to fix errors. See also -wf -wff -wf Write File containing all fixed parts          
-wff Same as above but give own filename     
-we Write File containing all errors      
-wef Same as above but give own filename     
-wc Write File containing all correct parts      
-wcf Same as above but give own filename -s Check only source language. Should be used before handing out to vendor.           
-t Check only Translation language(s). Should be used before merging.       
-k Allow KeyIDs to be present in strings       
-e disable encoding checks. E.g.: double questionmark '??' which may be the result of false conversions       
-l ISO Languagecode or numerical 2 digits Identifier of the source language. Default is en-US. Use "" (empty string) or 'none' to disable source language dependent checks          
-r Reference filename to check that source language entries have not been changed    

Readme check

Unfortunately gsicheck does not find errors in the readme section of the SDF file. The following script helps. Note that in grep -v " en-US " you should type <tab>en-US<tab>.

#!/bin/bash  
READMETMP=$(mktemp);
grep "^readlic" $@ | grep -v " en-US " | sed -e "s/</\\\</g" -e "s/>/\\\>/g" -e 's/"/\\\"/g' > $READMETMP;        
echo "**** $@ readme check ****";
gsicheck -l "" $READMETMP | sed -e "s/\\\>/>/g" -e "s/\\\</</g" -e 's/\\\"/"/g';

Usage:

./readmecheck.sh filename