Traslate Toolkit

 

Reference documentation

 

For information about the tools of the Translate Toolkit, please visit http://translate.sourceforge.net/

 

Javier Solá, David Fraser and Dwayne Bailey

 

Applies to Translate Toolkit version 0.8rc2. Last changed on 10/03/2005

 

 

The Translate Toolkit is a set of tools designed to standardise translation of Open Source applications. It permits translating quite a number of Open Source applications using the same translation tools.

 

It simplifies and facilitate the translation of some of the key end-user OpenSource applications: the OpenOffice application suite and applications belonging to the Mozilla family (Mozilla suite, Firefox, Thunderbird, etc.).

 

In all these applications, the messages that need to be translated to the target language are in specific files (each one with its own format). This Toolkit converts these files into a standard format (PO format) that is normally used for translation. The advantage of this conversion is that there are special editors to translate PO files, making the work of the translators very easy, seeing the original and the translation at the same time, knowing how much work has been done, saving all messages in a database (translation memory) that can be used in other files, etc. Once the files have been translated by the translators, tools in the Toolkit are used again to pack the translated files into a format that Mozilla or OpenOffice can understand.

 

For localization teams the most important advantage is that anybody doing translation only needs to learn how to use a simple PO file editor (such as poEdit or kBabel), and not a different tool and methodology for each application. PO editors tend to work well with all character sets, including Unicode, and some of them (poEdit, and reportedly now kBabel) work in both the Windows and Linux platforms, not forcing translators to use a specific platform for translation.

 

The tools are divided in three blocks: OpenOffice tools, Mozilla tools and generic support tools.

 

The Mozilla tools are formed by two programs:

  • moz2po     - Converts a Mozilla English Language Pack (XPI file) to PO format files.

  • po2moz     - Converts PO files (generated by moz2po and translated) back to Mozilla Language Pack format

The equivalent programs for OpenOffice are:

  • oo2po     - Converts OpenOffice GSI (SDF) files to PO format files.

  • po2oo     - Converts PO files (generated by oo2po and translated) back to GSI format.

Upgrade tool for both Mozilla and openOffice:

  • pot2po        - Upgrade to a new version of PO files for the same product / create PO files from POT files

 

PO 2 Xliff and viceversa transformation

 

  • xliff2po

  • po2xliff

 

Support tools are:

  • pocount      -  Count messages in a tree of PO files.

  • pofilter       -  Finds possible errors in PO files

  • PoMerge    -  Merges translated (corrected) messages from a PO file into another PO file.

 

moz2po

 

This program is part of the Translate Toolkit, a package designed to facilitate the translation of Open Source applications to new languages. Tools within the package are used to convert the Mozilla type files which contain translatable messages (.dtd and .properties files) to PO format (a standard file format used in Open Source). PO files can be easily translated using specialized editors. Then these tools are once again used to pack the translated files into a format that Mozilla can understand (a XPI Language Pack). They can be used with any of the Mozilla family applications (Firefox, Thunderbird, Mozilla, etc.).

 

The moz2po program unpacks an original Mozilla Language pack (a file with the .xpi extension) into a directory, converting the translatable (.dtd and .properties) files into equivalent standard PO files, while also making available to the translator other files that require changes (in order to localize the Language pack).

 

As input it takes a Mozilla American English Language Pack. This Language pack is a .XPI file (a zip format compressed file that includes all the files that need to be translated or localized).

 

As output it produces a whole new tree (a folder with subfolders inside) that contains all the files from the original Language pack (except for .dtd and .properties files, which have been translated to PO format). The folder produced contains the following subfolders:

 

    reg       

    contains PO files that need to be translated (which were originally in the US.jar file, inside the .xpi file) and other files to be localised

    lang-reg   

    contains PO files that need to be translated (which were originally in the en-US.jar file) and other files to be localised

    win   

    contains PO files that need to be translated (originally in the en-win.jar file) and other files to be localised.

    mac   

    contains PO files that need to be translated (originally in the en-mac.jar file) and other files to be localised.

    unix   

    contains PO files that need to be translated (originally in the en-unix.jar file) and other files to be localised.

    package   

    contains other files from the .xpi file that need to be localised. It follows the structure of the original XPI file

    Other folders   

    may contains PO files that need to be translated and other files to be localised.

    Template   

    contains a copy of the original English .xpi file, used later by po2moz to build the .xpi file for the target language. Do not touch it.

 

moz2po can also be used to convert to PO format a language pack that is already translated. As the language pack for your language does not have the English original messages (needed for the PO file), it also needs to use an original English language pack (en-US.xpi) as a template, so that it will have all the information needed for the PO files. This conversion (to PO format) permits the use of the information contained in the Mozilla files with a Translation Memory tool that uses PO files as input.

 

moz2po other use is to convert any tree of files that includes .dtd files and .properties files into another tree with identical structure that includes all the same files of the original tree, except that all these .dtd and .properties files are converted to PO files with the same name and with the to .dtd.po and .properties.po extensions.

 

This last application is useful for the new localization packs used in Mozilla products for CVS based localization. The Mozilla Foundation produces ZIP files that include a tree of files identical to the tree used for localization of a given language in the Mozilla-product CVS. Once localized, this packaged can be directly uploaded to CVS, and the Mozilla Foundation will produce the local language executable packages, as well as the installers.

 

This function must be used only once, before starting the translations. If it is used again once some of the PO files have been translated, it will overwrite the translated files with empty PO files, having to start the translation again.

 

Note: the format of the generated PO files is UTF-8, which allows this files to be translated to any language that uses Unicode. When translated back to ,dtd and .properties formats, .dtd files are generated in UTF-8 format, and .properties files in Escaped Unicode format, as required by Mozilla applications.

 

Different syntax is given for the different uses of the program:

 

Conversion of an original English XPI file into a tree of .po files and other localizable files

 

usage: moz2po [options]  INPUT OUTPUT

 

Arguments (mandatory):  
    INPUT INPUT is the filename (xpi extension included) of an original English language pack (an XPI file) belonging to an application of the Mozilla family (Mozilla, Firefox, Thunderbird, Camino).
    OUTPUT OUTPUT is the name of the directory inside which all the subfolders with the equivalent PO files, and all other information will be placed. If the folder itself does not exist, it will be created by moz2po. If the folder exists already, files inside might be overwritten.
   
Options:  
    -P  Produce PO template (.pot) files instead of Po files (.po), but the contents of the file is exactly the same. (note: .pot files are sometimes interpreted by MS Windows as PowerPoint template files, pay no attention to this).
    --version  Show program's version number and exit
    -h Show a help with the program’s usage syntax and exit

 

 

Examples:

 

moz2po –i en-US.xpi –o locale

 

This command creates - based on the en-US.xpi original English pack - the tree described above under the locale name, containing the structure of the package (in the locale\package subfolder), a copy of the en-US.xpi file in the locale\template sub-folder (to be used for repackaging), and other subfolders that contain PO files that need to be translated and other files which might need to be localised (locale\reg, locale\lang-reg, locale\win, etc.).

 

 

 

Conversion (migration) of an already translated language pack into a PO files and other localized files

 

usage: moz2po [options] -i INPUT -o OUTPUT –t TEMPLATE

 

Arguments (mandatory):  
    INPUT INPUT is the filename (xpi extension included) of a language pack of a given Mozilla family application that has already been translated into your language. It must have exactly the same structure as the original English pack used as TEMPLATE.
    OUTPUT OUTPUT is the name of the directory inside which all the subfolders with the equivalent PO files, and all other information will be placed. If the folder itself does not exist, it will be created by moz2po. If the folder exists already files inside might be overwritten.
    TEMPLATE TEMPLATE is an original English language pack (an XPI file) for the same Mozilla family application (and same program version) than the package that is used as INPUT.
   
Options:  
    --version  Show program's version number and exit
    -h Show a help with the program’s usage syntax and exit

 

Example:

 

moz2po -i km-KH.xpi -o locale -t en-US.xpi
 

This program takes the Khmer language pack for a Mozilla application (km-KH.xpi) and the original US English language pack for the same application (and version, en-US.xpi) and creates a directory of PO files that have in the original string (msgid) the English original and in the translation string (msgstr) the Khmer translation.

 

 This command creates - based on the km-KH.xpi file (an XPI language pack for Khmer language) and the en-US.xpi original English pack - the tree described above under the locale name, containing the structure of the km-KH.xpi package (in the locale\package subfolder), a copy of the en-US.xpi file in the locale\template sub-folder (to be used for repackaging), and other subfolders that contain PO files that already contain the translated strings from km-KH.xpi and other files which have already been localised in km-KH.xpi (such as contents.rdf files) These directories are named locale\reg, locale\lang-reg, locale\win, etc.

 

Conversion a tree that contains .dtd. and .properties files into a similar tree in which these files are turned into PO files.

usage: moz2po [options]  INPUT OUTPUT

 

Arguments (mandatory):  
    INPUT INPUT is the name of the folder that contains the tree of files that need to be converted to PO.
    OUTPUT OUTPUT is the name of the folder in which the output tree with all the PO files will be created. If the folder exists already files inside might be overwritten.
   
Options:  
    -P  Produce PO template (.pot) files instead of Po files (.po), but the contents of the file is exactly the same. (note: .pot files are sometimes interpreted by MS Windows as PowerPoint template files, pay no attention to this).
    --version  Show program's version number and exit
    -h Show a help with the program’s usage syntax and exit

 

 

Example:

 

moz2po –i EnglishTree –o localeTree

 

This instruction copies all the EnglishTree folder and its contents into localeTree, maintaining the subfolder structure. All files are copied to the second tree, except for .dtd and .properties files, which are replaced in the localeTree folder by their equivalent PO files with extensions .dtd.po and .properties.po

 

 

 

Po2moz

 

This program is part of the Translate Toolkit, a package designed to facilitate the translation of Open Source applications to new languages. Tools within the package are used to convert the Mozilla type files which contain translatable messages (.dtd and .properties) to PO format (a standard file format used in Open Source). PO files can be easily translated using specialized editors. Then these tools are once again used to pack the translated files into a format that Mozilla can understand (a XPI Language Pack). IT can be used with any of the Mozilla family applications (Firefox, Thunderbird, Mozilla, etc.).

 

Once the user has created a tree of localizable files using moz2po, and translated and localized everything that was required, po2moz takes all this tree again and converts it to a Language pack for your language.

 

The name of the locale of a language pack is used often inside the language pack. This name (<LanguageCode-RegionCode>, as en-US, km-KH, af-ZA, etc.) is passed to po2moz as an argument, and po2moz takes care of inserting it in file names or folder names in the destination pack when this is necessary.

 

po2moz can also be used to convert any tree of files that includes .dtd.po files and .properties.po files to another identical tree that includes the all the same files of the original tree, except that all these PO files are converted to .dtd and .properties files. This is useful for the new localization packs used in Mozilla products for CVS based localization. The Mozilla Foundation produces ZIP files that include o tree of files identical to the tree used for localization of a given language in the Mozilla-product CVS. The tree in these packs is converted to a tree that contains PO files using the moz2po tool, and after translation and localization, the tree is converted again with po2moz into a tree that contains translated .dtd and .properties files... and which can be uploaded directly into CVS.

 

In order to assure that all the original information from the original .dtd or .properties files is put into the newly generated file, it uses as templates the original .dtd and .properties files that are in the original folder from which the .po files where generated. Files in the target directory are re-written if the program is run more than once, but this does not have any side-effects, as the files are generated always from the PO files.

 

Note: PO files include the “&” character to specify that a given shortcut can be used (it does not always indicate this, when it followed by a word and a semicolon it indicates a variable name). The “&” indicates that the next character can be used as a shortcut. This shortcut character can be changed when editing to PO file, and a different character can be used for the short. If the “&” character is not present in the translation, po2moz will automatically include the old shortcut in the final .dtd file.

 

Different syntax is given for the different uses of the program:

 

Creation of an XPI file from localized PO files: 

 

usage: po2moz [options]-i INPUT -o OUTPUT -l LOCALE

 

Arguments (mandatory):  
    INPUT INPUT is the folder that contains all the information that will go into the XPI file. This folder was created by moz2po, and, as reference, is the folder that contains the subfolders reg, reg-lang, package, template, etc.
    OUTPUT OUTPUT is the name of the XPI file (including the .xpi extension) to be generated with all the translated and localised files.
    LOCALE LOCALE is the locale used in the new XPI file. It has the format xx-RR, where xx is the two character  ISO-639 code for the target language (if there is a two character code, otherwise it would be xxx-RR, where xxx is three letter character code for the language), and RR is the two letter ISO-3166 code for the country or region. See http://www.loc.gov/standards/iso639-2/ and http://www.iso.org/iso/en/prods-services/iso3166ma/index.html  if you need more information.
   
Options:  
    - x EXCLUDED EXCLUDED can be a file or a folder name. If it is a file, it is not included in the XPI file, if it is a folder, any files or subfolder that are contained in the EXCLUDED folder are not included in the XPI file. This can be used when there is additional information in the original XPI that is not desired in the final XPI, such as CVS information. You can use wildcards, if you enclose the filename in with quotes.
    --version  Show program's version number and exit
    -h Show a help with the program’s usage syntax and exit

 

Example:
 
po2moz -x CVS -x '*.diff" -i locale -o firefox1.0RC.km-KH.xpi -l km-KH
 

It takes the (already created with moz2po and translated) PO files contained in the locale directory, converts them to the original .dtd and .properties formats and with them it creates a language pack called firefox1.0RC.km-KH.xpi for the target language. In this package, locale sensible file names and directory names use KH as the region name and km-KH as the full locale name when needed. Do not include in the XPI files and directories called CVS, nor files with the "diff" extension.

 

Creation of a tree that contains translated .dtd. and .property files from localized PO files: 

 

 usage: po2moz [options] -i INPUT -o OUTPUT -t TEMPLATE

 

Arguments (mandatory):  
    INPUT INPUT is the folder that contains, directly or in subfolders, translated .dtd.po and .properties.po files, as well as other files needed for localization.
    OUTPUT OUTPUT is the name of folder in which the program will create a folder identical to the INPUT folder, except that .dtd.po files will be converted to .dtd files and .properties.po files will be converted to .properties files.
    TEMPLATE TEMPLATE is the original directory from which the INPUT directory was created (by using the moz2po program). It includes the original .dtd and .properties files in English. It is used to assure that the generated .dtd and .properties files are identical in structure to the original ones (to include information that could not be stored in the PO files).
   
Options:  
    - x EXCLUDED EXCLUDED can be a file or a folder name. If it is a file, it is not included in the XPI file, if it is a folder, any files or subfolder that are contained in the EXCLUDED folder are not copied to the OUTPUT folder. This can be used when there is additional information in the original folder that is not desired in the finalone, such as CVS information. You can use wildcards, if you enclose the filename in with quotes.
    --version  Show program's version number and exit
    -h Show a help with the program’s usage syntax and exit

 

Example:
 
po2moz -i locale -o firefox1.0RC-kmKH -t firefox1.0RC-enUS
 

It takes the (already translated) PO files contained in the locale directory, converts them to the original .dtd and .properties formats (with the help of the files contained in the original firefox1.0RC-enUS folder) and creates a new folder called firefox1.0RC-kmKH, identical in structure to locale and to firefox1.0RC-enUS folders, in which instead of PO files there are translated .dtd and .properties files.

 

 

 

oo2po

 

This program is part of the Translate Toolkit, a package designed to facilitate the translation of Open Source applications to new languages. Tools within the package are used to convert the Mozilla and OpenOffice type files which contain translatable messages (.dtd, .properties or GSI files) to PO format (a standard file format used in Open Source). PO files can be easily translated using specialized editors. Then these tools are once again used to pack the translated files into a format that Mozilla or OpenOffice can understand (a XPI Language Pack or a GSI file). The Toolkit can be used for OpenOffice or for any of the Mozilla family applications (Firefox, Thunderbird, Mozilla, etc.).

 

The oo2po program converts an OpenOffice GSI file (a file that contains all the messages used by OpenOffice) into a set of manageable POT files (PO templates, empty PO files) that can be easily used by translators, even distributed among several traslators (which would not be the case if only one large PO file had been created). These files are stored in a tree of folders. Once they have been translated, the po2oo tool can be used to convert the files back to GSI format, the format accepted by the OpenOffice project. It is nevertheless advisable to run pofilter before you convert back, to make sure that your files do not have any outstanding problems.

 

The oo2po utility has now been integrated in the OpenOffice build process. PO files for each version of OOo are produced directly by OpenOffice.org. This means that you (as a localizer) will normally not need to run this program.

 

As input, oo2po takes the GSi file corresponding to the version of OpenOffice that you wish to translate. If you are creating POT files, the GSI files only need to contain the English language. Nevertheless, it is also possible to have POT files in which the reference language used in the msgid fields of the PO files is other than English. In order to do this, it is necessary to have a GSI file that includes the language that you want to use as reference. This is very useful for countries in which the second language is French, Russian or some language other than English.

 

As output it produces a whole new tree (a folder with subfolders inside) that contains one POT file for each part of OpenOffice.

 

oo2po can also be used to convert to PO format GSI files that are already totally or partially translated to your language. In order to do this, you need to have a GSI file that has -at least- English and your language. oo2po will create files that have the original language as msgid and your languages in the msgstr.

 

In this second case, this function must be used only once, before starting the translations. If it is used again once some of the PO files have been translated, it will overwrite the PO files that you have worked on with PO files created again fom the GSI, having to start the translation again.

 

Note: the format of the generated PO files is UTF-8, which allows this files to be translated to any language that uses Unicode. 

 

As in the case of generating POT files, oo2po also permits using here as reference a language (in the msgid) different from English. For this it is necessary to have a GSI file that includes both the language that will be used as reference in the msgid and the target language that will be placed in the msgstr fields.

 

Conversion of an original English GSI file into a tree of .po files

 

usage: oo2po [options]  -P INPUT OUTPUT

 

Arguments (mandatory):  
    INPUT INPUT is the filename of the original English GSI file for the version that you with to translate.
    OUTPUT OUTPUT is the name of the directory inside which all the subfolders with the equivalent PO files will be placed. If the folder itself does not exist, it will be created by oo2po. If the folder exists already, files inside will be overwritten.
    -P  Produce PO template (.pot) files instead of Po files (.po), but the contents of the file is exactly the same. (note: .pot files are sometimes interpreted by MS Windows as PowerPoint template files, pay no attention to this). This argument is mandatory when producing only English files (with empty translations).
   
Options:  
    --source-language=ISO This option permits using a language different than US English as reference for the POT files (the language in which the messages are placed in the msgid field of the POT files). ISO is the OpenOffice ISO code of the language that will be used as reference in the msgid fields of the POT file. In order to use this option it is necessary to have an SDF file that contains that language specified in this option. If this option is not used, the default reference language is en_US (US English).
    --version Show program's version number and exit
    -h Show a help with the program’s usage syntax and exit

 

 

Examples:

 

moz2po -P en_US.sdf locale

 

This command creates - based on the en_US.sdf original English GSI file - a folder called locale with subfolders that contain all the POT (PO template) files needed by that version of OpenOffice, including helpfiles. These POT files are empty PO files that need to have their extension changed to .po when their transaltion start.

 

oz2po -P en_US_and_French.sdf locale --source-language=fr_FR

 

This command creates - based on the en_US_and_french.sdf GSI file (which contains at least the English and French messages) - a folder called locale with subfolders that contain all the POT (PO template) files needed by that version of OpenOffice, including helpfiles. These POT files are empty PO files that need to have their extension changed to .po when their transaltion start. As reference language in the msgid fields it has French French (fr_FR), as spoken in France itself!!

 

 

Conversion of an GSI file that has English (or other reference language) and -at least- another language into a tree of .po files that have all the available translations to that second language.

 

usage: oo2po [options]   -i INPUT -o OUTPUT -l LOCALE_CODE [--source-language=ISO]

 

Arguments (mandatory):  
    INPUT INPUT is the filename of the original English GSI file for the version that you with to translate.
    OUTPUT OUTPUT is the name of the directory inside which all the subfolders with the equivalent PO files will be placed. If the folder itself does not exist, it will be created by oo2po. If the folder exists already, files inside will be overwritten.
    -l LOCALE_CODE OpenOffice locale code for the translation that you want to place into the pre-translated PO files.
   
Options:  
    --source-language=ISO This option permits using a language different than US English as reference for the PO files (the language in which the messages are placed in the msgid field of the PO files). ISO is the OpenOffice ISO locale code of the language that will be used as reference in the msgid fields of the PO file. In order to use this option it is necessary to have an SDF file that contains that language specified in this option. If this option is not used, the default reference language is en_US (US English).
    --version Show program's version number and exit
    -h Show a help with the program’s usage syntax and exit

 

 

Example:

 

oo2po  -i en_US_and_km.sdf  -o locale -l km

 

This command creates - based on a GSi file that contains the original English and Khmer (partial or complete) translation (en_US_and_km.sdf) - a folder called locale with subfolders that contain all the PO files needed by that version of OpenOffice, including helpfiles. These PO files contain the original English in the msgid string and translations to Khmer (km) in the msgstr for the strings that it is available. Other strings are empty.

 

oo2po  -i en_US_and_pt_PT_some_pt_BR.sdf  -o locale -l pt_BR --source-language=pt_PT

 

This command creates - based on a GSi file that contains the original English and Portuguese Portuguese (complete) translations, as well as some Brazilian Portuguese (en_US_and_pt_PT_some_pt_BR.sdf) - a folder called locale with subfolders that contain all the PO files needed by that version of OpenOffice, including helpfiles. These PO files contain the original Portuguese Portuguese (pt_PT) in the msgid string and translations to Bazilian Portuguese (pt_BR) in the msgstr for the strings that it is available. Other strings are empty.

 

 

po2oo

 

This program is part of the Translate Toolkit, a package designed to facilitate the translation of Open Source applications to new languages. Tools within the package are used to convert the Mozilla and OpenOffice type files which contain translatable messages (.dtd, .properties or GSI files) to PO format (a standard file format used in Open Source). PO files can be easily translated using specialized editors. Then these tools are once again used to pack the translated files into a format that Mozilla or OpenOffice can understand (a XPI Language Pack or a GSI file). The Toolkit can be used for OpenOffice or for any of the Mozilla family applications (Firefox, Thunderbird, Mozilla, etc.).

 

The po2oo program converts a tree of PO files (that was either generated by oo2po or taken from the OpenOffice website, and then translated and filtered) into a GSI file that can be integrated into OpenOffice (a file that contains all the messages used by OpenOffice in a format that makes their integration easy).

 

As input, po2oo takes the folder (the tree) that contains all your PO files.

 

In order to make sure that the file generated is equivalent to the original one, the exact original (same version) English GSI file that was used to generate the POs by oo2po is used here as a template.

 

As output it produces a GSI file that can be automatically integrated in OpenOffice.

 

Inside the file, it is necessary to include the locale definition for which the messages are, this is done using the -l option.

 

By default, po2oo does not include in the final GSI file translations that are marked as fuzzy in the PO file, it includes the English original message instead. If it is considered better to include these translations, the --fuzzy option needs to be used.

 

If a reference language different than English was used for generating the PO files that we are working with (the --source-language option was used in oo2po), then it is necessary to again specify this language in po2oo, using the same --source-language option, with exactly the same locale code that was used in oo2po.

 

Conversion of translated PO files into an OpenOffice native GSI file

 

usage: po2oo [options]  -i INPUT -o OUTPUT -t TEMPLATE -l LOCALE [--source-language==ISO]

 

Arguments (mandatory):  
    INPUT INPUT is the name (path) of the directory inside which all the subfolders with the PO files are located.
    TEMPLATE TEMPLATE is the name (path) of the original GSI file that was used to generate the PO files that you are not converting back.
    OUTPUT OUTPUT is the name of the GSI file that will be created. It is a good idea to use the .sdf extension, as it defines the format. If the file exists already, it will be overwritten.
    LOCALE Locale is the name of the locale that you are transalting for. It is either the two-letter (or three-letter if there is no two-letter) language code, or the mentioned language code, a hyphen, and the country code. Examples are km, es-CL, ta-IN... The languages page of OpenOffice defines the locale for each project. For versions of OpenOffice prior to 2.0 (1.1.x), this is actually a number assigned by OpenOffice to the project, and which can also be found in the languages page of OpenOffice.
   
Options:  
    --source-language=ISO This option must be used if a language different than US English is used as a reference in the msgid of the PO files that are being used as input (this only happens if the --source-language option was used in oo2po when the PO or POT files were enerated).  ISO is the OpenOffice ISO locale code of the language that is used as reference in the msgid fields of the PO file, it has to exactly the same that was used in oo2po when these PO or POT files we generated. If the option is not used, the default reference language is assumed to be en_US (US English).
   --fuzzy When this option is included, translations that in the PO files are considered as "fuzzy", will be included in the GSI file generated by po2oo. If it is not used, fuzzy translation will not be included (the original English message is included instead). A message is considered as fuzzy when, in the PO file, the message is preceeded by the line "#, fuzzy".
   -x EXCLUDED EXCLUDED can be a file or a folder name. If it is a file, it is not taken into account for the GSI file, if it is a folder, any files or subfolder that are contained in the EXCLUDED folder are not used to build the OUTPUT file. This can be used when there is additional information in the original folder that is not desired in the OUTPUT file, such as CVS information. You can use wildcards, if you enclose the filename in with quotes.
    --version Show program's version number and exit
    -h Show a help with the program’s usage syntax and exit

 

 

Example:

 

oo2po -x CVS -x '*.diff' –i locale –t en_US.sdf -o en_CL.sdf -l en-CL

 

Given a directory called locale that contains all the OOo PO files that have been translated to your language, and given en_US.sdf, the original GSI file from which those PO files were originated,create a new GSI file with the translations called es_CL.sdf, using the locale code es-CL inside that file. Ignore files and directores called CVS or files that have the .diff extension.

 

 

pot2po

 

This program is part of the Translate Toolkit, a package designed to facilitate the translation of Open Source applications to new languages. Tools within the package are used to convert the Mozilla and OpenOffice type files which contain translatable messages (.dtd, .properties or GSI files) to PO format (a standard file format used in Open Source). PO files can be easily translated using specialized editors. Then these tools are once again used to pack the translated files into a format that Mozilla or OpenOffice can understand (a XPI Language Pack or a GSI file). The Toolkit can be used for OpenOffice or for any of the Mozilla family applications (Firefox, Thunderbird, Mozilla, etc.).

 

The pot2po program has two possible funtions:

  1. Given the PO files for an application that have already been translated, and POT files for a newer version of the same application, create a set of PO files for the new version that include all the translations that were already in the PO files for the old version.

  2. Given a tree that contains POT files, it creates an identical tree, with the same files, but the extension on the files of the new tree will be ".po", instead of ".pot".

It takes as INPUT the name of the folder that contains the POT files, as OUTPUT the name of the folder to which the PO files will be created, and as a TEMPLATE the directory that contains the PO files for the old version of the same product.

 

Upgrade an applications PO files to the new version, maintaining the translations

 

usage: pot2po [options]  -i INPUT -o OUTPUT -t TEMPLATE

 

Arguments (mandatory):  
    INPUT INPUT is the name (path) of the folder that contains the POT files for the new version of the application.
    OUTPUT OUTPUT is the name of the folder to which the PO files for the new version will be written, containing also all translated messages that were already translated in the PO files of the old version (PO files that are in the TEMPLATE directory). The program will create in OUTPUT a tree identical to the tree in INPUT. If a file is present in INPUT, but not present in TEMPLATE, an empty copy of the POT file will be generated as PO file in the OUTPUT folder. If the TEMPLATE and OUTPUT folders are the same, the old PO files will be replaced by the upgraded ones.
    TEMPLATE TEMPLATE is the name (path) of the folder that contains the PO files for the old version of th eprogram, from which we desire to recover the already translated messages.
   
Options:  
    --version Show program's version number and exit
    -h Show a help with the program’s usage syntax and exit

 

 

Example:

 

pot2po –i new_version_pots –t old_version_pos -o new_version_pos

 

Given a set of already translated PO files for a product A, localed in the folder old_version_pos, and a set of POT files for a newer version of the same product A, in folder new_version_pots (both trees being identical), a new tree is created in new_version_pos that has copies of all the files in new_version_pots, but the new files have ".po" extensions. All translated messages that have been found in the same files in old_version_pos have been copied into these new files. As a result, new_version_pos  contains the PO files for the new version, and only new messages that were not present in the old version need to be translated now.

 

 

Create PO files from a set of POT files

 

usage: pot2po [options]  -i INPUT -o OUTPUT

 

Arguments (mandatory):  
    INPUT INPUT is the name (path) of the folder that contains the POT files
    OUTPUT OUTPUT is the name of the folder to which the PO files will be written.
   
Options:  
    --version Show program's version number and exit
    -h Show a help with the program’s usage syntax and exit

 

 

Example:

 

pot2po –i pot_files -o po_files

 

Given set of POT files in folder po_files, create an equivalent set of PO files in folder po_files.

 

 

PoCount

 

This program is part of the Translate Toolkit, a package designed to facilitate the translation of Open Source applications to new languages. Tools within the package are used to convert the Mozilla and OpenOffice type files which contain translatable messages (.dtd, .properties or GSI files) to PO format (a standard file format used in Open Source). PO files can be easily translated using specialized editors. Then these tools are once again used to pack the translated files into a format that Mozilla or OpenOffice can understand (a XPI Language Pack or a GSI file). The Toolkit can be used for OpenOffice or for any of the Mozilla family applications (Firefox, Thunderbird, Mozilla, etc.).

 

The pocount program counts the number of messages and words (translatable words words included in the messages) in a PO (or POT) file or in a folder or tree containing PO (or POT) files.

 

Count the number of messages and words.

 

usage: pocount [options]  PATH

 

Arguments (mandatory):  
    PATH INPUT is the name of the file or folder in which we desire to count messages.
   
Options:  
   --csv Produce output in CSV format (comma separated), one line per file, so that it can be inported into a spreadsheet.
    --version Show program's version number and exit
    -h Show a help with the program’s usage syntax and exit

 

 

Example:

 

pocount afile.po

 

Returns the number of messages and translatable words in the afile.po file.

 

pocount po_folder

 

Returns the aggregated number of messages and translatable words in all PO and POT files contained in the directory po_folder.

 

 

 

PoFilter

 

Given a PO file, or a set of PO files, the pofilter program tests if the entries of the(se) file(s) fulfill certain conditions of correctness. The incorrect entries (each entry being composed of a msgid original string and a msgstr translated string) are saved into a new file, so that entries in this file can be corrected and then merged back into the PO file (by using the program pomerge).

 

For each entry considered as not correct by pofilter, it will include a standard PO entry in the output file, preceded by a comment explaining the type of error detected and by a comment identifying the translation as fuzzy. Such message may something like:

 

#_whitespace: whitespace at the beginning or end of the string did not match

#, fuzzy

#_test: test description

 

PO filter can be applied to a single file, to all the PO files in a directory or to all the PO files in a given tree. The output will take the same shape as the input, creating a file, a directory or a tree of files.

 

There are quite a number of filters that may be used in the program, each one of them testing for a given condition of correctness. The user may select which filters he wishes to use. These filters are:

 

·     blank              - Checks whether a translation is totally blank

·     doublequoting      - Checks whether double quoting is consistent between the two strings

·     endpunc            - Checks whether punctuation at the end of the strings match

·     escapes            - Checks whether escaping is consistent between the two strings

·     numbers            - Checks whether numbers of various forms are consistent between the two strings

·     purepunc           - Checks that strings that are purely punctuation are not changed

·     short              - Checks whether a translation is much shorter than the original string

·     simplecaps         - Checks the capitalisation of two strings isn't wildly different

·     singlequoting      - Checks whether single quoting is consistent between the two strings

·     startpunc          - Checks whether punctuation at the beginning of the strings match

·     unchanged          - Checks whether a translation is basically identical to the original string

·     untranslated       - Checks whether a string has been translated at all

·     variables          - Checks whether variables of various forms are consistent between the two strings

·     whitespace         - Checks whether white spaces at the beginning and end of the strings match

·    musttranslatewords - Checks that words configured as definitely translatable don't appear in the translation. So if you want 'OK' to always be translated you can now flag when it appears as 'OK' in the translation.

·    notranslatewords   - Checks that words configured as untranslatable appear in the translation too. For example, if you don't want brand names eg. Writer, Calc, Draw, Impress translated then you can check that they also appear untranslated in the translation.

·     spellcheck         - Checks words that don't pass a spell check.  Spell checks with Enchant, failing that, jToolkit the errors and suggestions appear in the error message.  Word that also fail in the msgid are ignored ie if some word fails an English check then we ignore it in the translation this should prevent you having to see all brand names and program names as errors.

·     validchars         - Checks that only characters specified as valid appear in the translation.  You create a list of valid characters for your language.  Anything that does not appear will be flagged.  This help catch UTF-8 encoding issues.  Be aware that you need to add some strange characters like percent, degree, etc.

·     autocorrect         - Contrary to other functions of pofilter, this switch will not only extract string to an output file, it will actually send to the output files corrected strings. It will: a) Remove/add a white space at the beginning and end of a message so that the msgid and msgstr match. b) It will try to match the capitals at the beginning of a sentence. Ie if you translated in lowercase and the original is uppercase then it will change your first letter to uppercase. c)  If you left out the ellipses (...) or a colon that are present in the original, then it will add them. If you have them and they shouldn't be there then it will delete them. This should be used only in scripts that have capital and follow western typographic rules (such as not placing a space before a punctuation mark or using Latin colon characters). It should not be used on CTL or East Asian languages.


 

usage: pofilter [options] -i INPUT -o OUTPUT

 

Arguments (mandatory):  
    INPUT

INPUT can be either the filename of a PO file that needs to be checked or the name of a directory that contains PO files that need to be checked. If it is the name of a folder and the option –R is not used, INPUT will only refer to the files in that folder. If the –R (recursion) option is used; it will refer to all PO files in that folder and any other folders contained in the folder (in the tree of which this folder is the root).

    OUTPUT In case INPUT is the name of a file; OUTPUT must be the name of the file to which the errors will be written. The file does not need to exist before. If it exists it will be erased before the filtering process starts. If INPUT is a directory, OUTPUT also needs to be a directory to which error files will be written to. If the –R (recursion) option is used, other folder may be created inside if they are needed but do not exist. Files created by pofilter in OUTPUT when INPUT is a directory will have the same names as the original INPUT files.
Options:  
   --mozilla

Use the standard checks for Mozilla translations. This adjusts the filter to work from files generated from Mozilla files, assuring that the & mark is used for shortcuts, etc.

   --openoffice Use the standard checks for OpenOffice translations. Same as above, but for OpenOffice.
   --gnome Use the standard checks for Gnome translations. Same as above, but for Gnome.
   --excludefilter=NOFILTER NOFILTER is either a filter o a list of filters separated by spaces (using the names listed above). All filters, except the ones included in NOFILTER will be used by the program. This can be used several times in the same command.
   -t YESFILTER YESFILTER is either a filter o a list of filters separated by spaces (using the names listed above). If this option is used, only filters included in YESFILTER will be used during the test.
   --header Include a PO header in the PO files that are generated by pofilter. The header is sometimes used by PO file editors to know if a PO file is in UTF-8 format, the file will otherwise be consider it as ISO-8859-1. This header is ignored by pomerge (any heathers are ignore by pomerge.
   -x EXCLUDED EXCLUDED can be a file or a folder name. If it is a file, it is not taken into account for the GSI file, if it is a folder, any files or subfolder that are contained in the EXCLUDED folder are not used to build the OUTPUT file. This can be used when there is additional information in the original folder that is not desired in the OUTPUT file, such as CVS information. You can use wildcards, if you enclose the filename in with quotes.
   ---review Include elements marked for review (re-writing). Entries of PO files that have been translated and submitted can be earmarked for review (re-writing) by a first reviewer. While reviewing translations, reviewers sometimes pick up subtle errors, such as bad word choice or places where the translator has incorrectly maintained English language). If the reviewer thinks that the entry has to be checked, he/she will include in the PO file (before the msgid) a line of the form:
#, review - some comment…
If the review option is used, and such line appears in an entry, the entry will be copied to the OUTPUT file.
   --ignorereview Don't include elements marked for review.

   --language=LANG

Set target language code (e.g. af-ZA) [required for spell check].

   --notranslatefile=FILE

Read list of untranslatable words from FILE(words that must not be translated).

   --musttranslatefile=FILE

Read list of translatable words from FILE (words that must be translated)

   --validcharsfile=FILE

Read list of all valid characters from FILE(file must be in UTF-8).

   -l List available filters and exit.
   --version Show program's version number and exit
   -h Show a help with the program’s usage syntax and exit

 

 

 
 

PoMerge

 

This function takes translated messages from a PO file and used them to fill the translation field (msgstr) of another PO file that has at least some identical messages in English (which need to be translated the same way). It is useful for updating translations to new version of a product. The PO file for the new product usually has almost all the messages of the old version, but it also has new messages. This utility fill in the old translations in the new file, leaving only empty the fields for translations that did not exist before, and therefore helping translators avoid having to retype the translations.

 

It is also used – in conjunction with pofilter - to correct errors in PO files. Pofilter will select the entries that have possible errors and place them in a separate file. Once these errors are corrected, pomerge can be use to automatically integrate (replace) the corrected translations in the old document.

 

For each entry in each target PO file (in the TEMPLATE folder), the program looks if there is an entry with identical original English string (msgid) in the file of the INPUT directory that has the same name. If it finds it, the replacement entry from the INPUT directory file will be used in the file written to the OUTPUT directory. If no entry is found in the INPUT directory file, the entry from the TEMPLATE directory file will be used.

 

pomerge can be used in two different ways, depending on if you want to create a new directory in which the resulting PO files are stored (without touching either the original PO files or the corrections), or if you want to directly modify the original PO files: if the TEMPLATE and OUTPUT folders are different, then the files in the TEMPLATE directory will not be affected, and new files will written to the OUTPUT directory. If the TEMPLATE and OUTPUT folders are identical, then the files in that FOLDER will be modified and corrected with the corrections made in the INPUT folder.

 

usage: pomerge [options]-i INPUT -o OUTPUT -t TEMPLATE

 

Arguments (mandatory):  
    INPUT INPUT is the folder that contains all PO files with correct (or corrected) translations. This data will be used to modify the PO files of the same names that are placed in the TEMPLATE directory, placing the result in the OUTPUT directory.
    OUTPUT OUTPUT is the name of the folder in which the PO files with all the correct data (correct translations from the INPUT and TEMPLATE folders)  will be placed. If OUTPUT is the same directory as TEMPLATE, the files will be overwritten with the corrections.
    TEMPLATE

TEMPLATE is the directory that contains the PO files that either need correction or that have empty msgstr fields that need to be filled. The files in the TEMPLATE directory will not be altered, unless the TEMPLATE and OUTPUT folders are the same

   
Options:  
   -x EXCLUDED EXCLUDED can be a file or a folder name. If it is a file, it will not be considered when merging, if it is a folder, any files or subfolder that are contained in the EXCLUDED folder wil not be considered. This can be used when there is additional information in the original folder that is not desired for merging. You can use wildcards, if you enclose the filename in with quotes.
    --version Show program's version number and exit
    -h Show a help with the program’s usage syntax and exit

 

 

Examples :

 

pomerge -i errors/ -o existing_files/ -t existing_files

 

After generating an error directory by using the pofilter utility on the existing_files directory; and then correcting the mistakes in the files of the errors directory, this function merges the corrections back into the files of the existing_files directory (overwrites them, as the template and output directories are identical).