Translating PO Files

From Creative Commons
Revision as of 16:54, 4 October 2007 by Nathan Yergler (talk | contribs) (New page: Translations for Creative Commons software and web applications are stored in gettext message catalogs. Creative Commons uses [http://translate.creativecommons.org Pootle] t...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Translations for Creative Commons software and web applications are stored in gettext message catalogs. Creative Commons uses Pootle to provide a web-based translation interface. Using Pootle is the preferred method for translating ccPublisher. Instructions for using Pootle can be found here. This page describes how to create translations using other tools for manipulating the message catalogs.

Getting Started

Download the .pot files from Pootle

Translating using poEdit

poEdit is an Open Source cross-platform gettext catalogs (.po files) editor. It is built with wxWidgets toolkit and can run on any platform supported by it. It aims to provide more convenient approach to editing catalogs than launching Notepad (or vi) and editing the file by hand. Official releases are available from the poEdit web site for Windows and Linux. A version for Mac OS X is available at http://www.poedit.net/download.php#osx. The poEdit team reports it is a beta release and the 1.3.6 version is known to be broken, but some translators have had success using it for ccPublisher.

Just use poEdit's File -> New catalog from POT file... function will easily doing so. It even can compile .po into .mo file in the same time you pressing Save.

Translating under Windows

To translate under Windows, download and install an i18n-enabled release (2.1 or later). In the installation directory you will find a resources directory, which contains the locale subdirectory. Create a new subdirectory under locale with a name matching your new locale. For example, to translate ccPublisher into French, create a directory named fr_FR.

The ccPublisher locale folder (full size).

Copy the template files from locale into your new directory; rename them from .pot to .po.

The .po files for the new locale (full size).

Edit each .po file per the instructions above.

Editting the .po file (full size).

If you are translating ccPublisher to your default locale, simply run ccPublisher to test your translation. If you are translating to a different locale, create a shortcut to ccp.exe and modify it to pass the --locale parameter in.

Editting a shortcut to ccp.exe to specify a locale (full size).

When you run ccPublisher with the new locale, the message catalogs will be compiled and the application should reflect your translation.

ccPublisher running with the French locale specified; note the File menu reflects the change to Dossier (full size).

Translating under Mac OS X

Translations for Mac OS X are currently shipped inside the application bundle. To find the translation files via the Finder, right click on the ccPublisher application and select Show Package Contents. This will open the application bundle in a Finder window. The locale files are stored in Contents -> Resources -> resources -> locale. Navigate to the locale directory and follow the instructions for Linux or Windows.

Submitting a Translation

Once you have completed or updated a translation and tested it, you can submit it to the ccPublisher developers using the Roundup bug tracking system. Click here to create a new issue with the correct default values set. Add the locale information for your new translation to the title and attach the .po and .html files you created (either individually or in a zip/tar file).

We encourage people submitting bugs and feature requests via Roundup to create accounts so they can easily monitor issues they create.

Updating Translations

Strings are sometimes added or removed from the application during development cycles. At those times it is necessary to update the translation (.po) files with the new strings and translations.

Using poEdit

If you are using poEdit, you can use the Update from POT file... option. Go to the Catalog menu and select Update from POT file.... Select the .pot file which cooresponds to the translation you have open (i.e. if you are updating ccpublisher.po, select ccpublisher.pot).

Poedit select catalog template.png

poEdit will display the new strings it will add, as well as the obsolete strings it will remove.

Poedit approve updates.png

Using GNU gettext tools

The GNU gettext tools include a command-line tool called msgmerge which may be used to merge two catalogs together. For example, to use msgmerge for ccpublisher.po, you can use the following commands (Linux):

 $ cd resources/locale/en_US
 $ msgmerge ccpublisher.po ../ccpublisher.pot > new_ccpublisher.po

This will create a new file (new_ccpublisher.po) containing the merged translations. After examining it, rename it to the original file name (ccpublisher.po).