Difference between revisions of "Translating PO Files"

From Creative Commons
Jump to: navigation, search
m (Reverted edits by Tsanioke (talk) to last revision by Tommyogp)
 
(7 intermediate revisions by 5 users not shown)
Line 7: Line 7:
 
=== Translating using poEdit ===
 
=== Translating using poEdit ===
  
[http://www.poedit.net/ 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.  
+
[http://www.poedit.net/download.php 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'''.
 
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'''.
Line 21: Line 21:
 
=== Using poEdit ===
 
=== Using poEdit ===
  
If you are using [http://poedit.org 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).   
+
If you are using [http://www.poedit.net/download.php 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).   
  
[[Image:Poedit_select_catalog_template.png]]
+
[[Image:Poedit_select_catalog_template.png|600px]]
  
 
poEdit will display the new strings it will add, as well as the obsolete strings it will remove.
 
poEdit will display the new strings it will add, as well as the obsolete strings it will remove.
  
[[Image:Poedit_approve_updates.png]]
+
[[Image:Poedit_approve_updates.png|600px]]
  
 
=== Using GNU gettext tools ===
 
=== Using GNU gettext tools ===
Line 36: Line 36:
 
   $ msgmerge ccpublisher.po ../ccpublisher.pot > new_ccpublisher.po
 
   $ msgmerge ccpublisher.po ../ccpublisher.pot > new_ccpublisher.po
  
This will create a new file (<code>new_ccpublisher.po</code>) containing the merged translations.  After examining it, rename it to the original file name (ccpublisher.po).
+
This will create a new file (<code>new_ccpublisher.po</code>) containing the merged translations.  After examining it, rename it to the original file name (<code>ccpublisher.po</code>).

Latest revision as of 14:44, 23 March 2012

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

To begin translating a Creative Commons application, you will need the PO Template (.pot) file(s). These are typically stored in Subversion in a template locale directory. If you have questions about where to find the templates for a specific project, email the cc-devel mailing list.

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.

Submitting a Translation

Once you have completed or updated a translation and tested it, you can submit it by emailing the cc-devel mailing list.

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).