Difference between revisions of "Translating with Pootle/Administration"

From Creative Commons
Jump to: navigation, search
(Add a new language to an existing project: Use "svn cp")
(Mention the all-important buildout step)
Line 1: Line 1:
 
So you're an admin of some kind, and you want to:
 
So you're an admin of some kind, and you want to:
  
All of this assumes you have a read/write checkout of
+
All of this assumes you have a fully-prepared checkout of
 
svn+ssh://svn@code.creativecommons.org/svnroot/i18n/trunk.  One other important note is that CC uses two different types of PO files: The "normal" PO files with English keys, used by Pootle, and also PO files with logical keys, which are used by cc.engine to actually render the site.
 
svn+ssh://svn@code.creativecommons.org/svnroot/i18n/trunk.  One other important note is that CC uses two different types of PO files: The "normal" PO files with English keys, used by Pootle, and also PO files with logical keys, which are used by cc.engine to actually render the site.
 
* ./i18n/trunk/po = English-key PO files
 
* ./i18n/trunk/po = English-key PO files
Line 7: Line 7:
  
 
'''<span style='color: red'>Note: most of this is relative to the project creativecommons.org and may or may not apply to other projects.</span>'''
 
'''<span style='color: red'>Note: most of this is relative to the project creativecommons.org and may or may not apply to other projects.</span>'''
 +
 +
== Fully-prepared checkout ==
 +
 +
To create a fully prepared checkout, do this:
 +
 +
<pre>
 +
$ svn co svn+ssh://svn@code.creativecommons.org/svnroot/i18n/trunk i18n-trunk
 +
(a lot of svn output will fly by)
 +
 +
$ cd i18n-trunk
 +
$ python bootstrap/bootstrap.py
 +
(a fair bit of output will follow; the last line should be like:)
 +
Generated script '/some/path/i18n-trunk/bin/buildout'.
 +
$ ./bin/buildout
 +
(a fair bit of output will again follow; the last should be like:)
 +
Generated interpreter '/some/path/i18n-trunk/bin/python'.
 +
$
 +
</pre>
  
 
== Add a new string ==
 
== Add a new string ==

Revision as of 21:31, 18 November 2008

So you're an admin of some kind, and you want to:

All of this assumes you have a fully-prepared checkout of svn+ssh://svn@code.creativecommons.org/svnroot/i18n/trunk. One other important note is that CC uses two different types of PO files: The "normal" PO files with English keys, used by Pootle, and also PO files with logical keys, which are used by cc.engine to actually render the site.

  • ./i18n/trunk/po = English-key PO files
  • ./i18n/trunk/i18n = logical-key PO files (CC-style)

Note: most of this is relative to the project creativecommons.org and may or may not apply to other projects.

Fully-prepared checkout

To create a fully prepared checkout, do this:

$ svn co svn+ssh://svn@code.creativecommons.org/svnroot/i18n/trunk i18n-trunk
(a lot of svn output will fly by)

$ cd i18n-trunk
$ python bootstrap/bootstrap.py
(a fair bit of output will follow; the last line should be like:)
Generated script '/some/path/i18n-trunk/bin/buildout'.
$ ./bin/buildout
(a fair bit of output will again follow; the last should be like:)
Generated interpreter '/some/path/i18n-trunk/bin/python'.
$ 

Add a new string

./i18n/trunk/master/cc_org.po

As the directory name implies, this is the "master" PO file. This is a CC-style PO file. You add your new strings to this file using whatever naming rules might be in effect for the type of string you are adding. Commit your change.

./i18n/trunk/bin/sync

Once you have added your new string(s) you must run ./bin/sync with no arguments. This will propagate the new string(s) to all of the English-key PO files. Commit the many changes which should be visible in the ./i18n/trunk/po/ directory.

Make new string(s) available to Pootle

$ ssh translate.creativecommons.org
$ cd /var/www/translate.creativecommons.org/po/
$ svn up

Add a new language to an existing project

If you are adding a language which already exists for another country (e.g. Spanish), then the easiest thing to do is, for example:

$ ssh translate.creativecommons.org
$ sudo su - pootle
$ cd /var/www/translate.creativecommons.org/po/cc_org/
$ svn copy es es_PR
$ cd es_PR
$ svn rm --force *.stats *.prefs *.pending
$ svn rm --force es_PR/*.stats
$ cd ..
$ svn ci -m "Created Puerto Rico PO directory using Spain's as a base" es_PR

If you are creating a language that doesn't already exist for some other country, then you can create that language at http://translate.creativecommons.org/admin/languages.html and then add it to a given project using the Pootle interface. You could also follow the steps above, using en_US as a base (in the example above substitute 'es' with 'en_US').

Since you've just added a new language, this is also a good time to add a translatable string for the language name itself. This is done by using the steps outlined above in Add a new string. Using the example above, you should add the following to ./i18n/trunk/master/cc_org.po:

msgid lang.es_PR
msgstr "Spanish (Puerto Rico)"

Change an English string

Changing an English string is done precisely like Adding a new string, with the exception that you modify an existing string in ./i18n/trunk/master/cc_org.po instead of adding a new one.