Difference between revisions of "Translating with Pootle/Administration"

From Creative Commons
Jump to: navigation, search
(No TOC)
 
(12 intermediate revisions by 3 users not shown)
Line 9: Line 9:
  
 
'''<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>'''
 +
 +
<h3>NOTE: to avoid '''conflicts''' when merging your changes into the pootle checkout it is recommended to do the following before anything else:</h3>
 +
<pre>
 +
$ ssh translate.creativecommons.org
 +
$ sudo su - pootle
 +
$ cd ~/checkouts/$project/cc-i18n-trunk
 +
$ svn ci -m "Committing any pending changes before making changes to the PO files."
 +
</pre>
 +
... then update your local checkout before doing any of the operations below.
  
 
== Fully-prepared checkout ==
 
== Fully-prepared checkout ==
Line 16: Line 25:
 
<pre>
 
<pre>
 
$ svn co svn+ssh://svn@code.creativecommons.org/svnroot/i18n/trunk i18n-trunk
 
$ svn co svn+ssh://svn@code.creativecommons.org/svnroot/i18n/trunk i18n-trunk
(a lot of svn output will fly by)
+
...
 
 
 
$ cd i18n-trunk
 
$ cd i18n-trunk
 
$ python bootstrap/bootstrap.py
 
$ 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'.
 
Generated script '/some/path/i18n-trunk/bin/buildout'.
 
$ ./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'.
 
Generated interpreter '/some/path/i18n-trunk/bin/python'.
$
 
 
</pre>
 
</pre>
  
 
== Add a new string ==
 
== Add a new string ==
  
===./i18n/trunk/master/cc_org.po===
+
=== New string: (1) update master 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.
+
 
 +
As the directory name implies, '''i18n/trunk/master/cc_org.po''' 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.
 +
 
 +
=== New string: (2) sync ===
  
===./i18n/trunk/bin/sync===
+
$ ./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.
+
$ ./bin/po2cc -i po -o i18n
 +
 
 +
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. Running po2cc with those arguments will push those changes into the CC-style, short-name-key PO fies. Commit the many changes which should be visible in the '''po/''' and '''i18n/''' directories.
 +
 
 +
=== New string: (3) Make new string(s) available to Pootle ===
  
=== Make new string(s) available to Pootle ===
 
 
<pre>
 
<pre>
 
$ ssh translate.creativecommons.org
 
$ ssh translate.creativecommons.org
$ cd /var/www/translate.creativecommons.org/po/
+
$ sudo su - pootle
 +
$ cd ~/checkouts/$project/cc-i18n-trunk
 
$ svn up
 
$ svn up
 
</pre>
 
</pre>
Line 47: Line 61:
 
If you are adding a language which already exists for another country (e.g. Spanish), then you must create the language both in the i18n/ directory as well as in the po/ directory.  Secondly, you must also enable it in Pootle.  Finally, you should add a key to the master PO file that names the language.
 
If you are adding a language which already exists for another country (e.g. Spanish), then you must create the language both in the i18n/ directory as well as in the po/ directory.  Secondly, you must also enable it in Pootle.  Finally, you should add a key to the master PO file that names the language.
  
=== Add a new language: (1) in your checkout ===
+
=== New language: (1) in your checkout ===
  
 
For our example we consider that the new language is es_PR, which is based on Spanish (es).  For a language not obviously derived from a different one, you can consider it based on US English (en_US).
 
For our example we consider that the new language is es_PR, which is based on Spanish (es).  For a language not obviously derived from a different one, you can consider it based on US English (en_US).
Line 65: Line 79:
 
</pre>
 
</pre>
  
=== Add a new language: (2) in Pootle ===
+
=== New language: (2) in Pootle ===
  
 
Now log into Pootle's PO files repository and make your files available there:
 
Now log into Pootle's PO files repository and make your files available there:
Line 71: Line 85:
 
<pre>
 
<pre>
 
$ ssh translate.creativecommons.org
 
$ ssh translate.creativecommons.org
$ cd /var/www/translate.creativecommons.org/po/cc_org/
+
$ sudo su - pootle
 +
$ cd ~/checkouts/cc_org/cc-i18n-trunk
 
$ svn up i18n/es_PR po/es_PR
 
$ svn up i18n/es_PR po/es_PR
 
</pre>
 
</pre>
Line 77: Line 92:
 
At this point, you should go to http://translate.creativecommons.org/admin/languages.html and ensure the language is associated with the cc_org project (and any others) using the Pootle interface.
 
At this point, you should go to http://translate.creativecommons.org/admin/languages.html and ensure the language is associated with the cc_org project (and any others) using the Pootle interface.
  
=== Add a new language: (3) update master PO file ===
+
=== New language: (3) update master PO file ===
  
 
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:
 
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:
Line 88: Line 103:
  
 
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.
 
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.
 +
 +
=== Future dreaming ===
 +
 +
Having changed this English string, run ./bin/sync.  This will go through the PO-style PO files and, if translations for a string with that as context exist, either:
 +
* Migrate the translation to the new English value, or
 +
* Move the translation out of the PO-style file into the suggestions file, and delete the translation from the PO-style file
 +
 +
I think the second is the better option.
 +
 +
== Documentation ==
 +
 +
=== Fallback ===
 +
 +
* ?!

Latest revision as of 14:59, 30 April 2010


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.

NOTE: to avoid conflicts when merging your changes into the pootle checkout it is recommended to do the following before anything else:

$ ssh translate.creativecommons.org
$ sudo su - pootle
$ cd ~/checkouts/$project/cc-i18n-trunk
$ svn ci -m "Committing any pending changes before making changes to the PO files."

... then update your local checkout before doing any of the operations below.

Fully-prepared checkout

To create a fully prepared checkout, do this:

$ svn co svn+ssh://svn@code.creativecommons.org/svnroot/i18n/trunk i18n-trunk
...
$ cd i18n-trunk
$ python bootstrap/bootstrap.py
...
Generated script '/some/path/i18n-trunk/bin/buildout'.
$ ./bin/buildout
...
Generated interpreter '/some/path/i18n-trunk/bin/python'.

Add a new string

New string: (1) update master PO

As the directory name implies, i18n/trunk/master/cc_org.po 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.

New string: (2) sync

$ ./bin/sync
$ ./bin/po2cc -i po -o i18n

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. Running po2cc with those arguments will push those changes into the CC-style, short-name-key PO fies. Commit the many changes which should be visible in the po/ and i18n/ directories.

New string: (3) Make new string(s) available to Pootle

$ ssh translate.creativecommons.org
$ sudo su - pootle
$ cd ~/checkouts/$project/cc-i18n-trunk
$ svn up

Add an entirely new language

If you are adding a language which already exists for another country (e.g. Spanish), then you must create the language both in the i18n/ directory as well as in the po/ directory. Secondly, you must also enable it in Pootle. Finally, you should add a key to the master PO file that names the language.

New language: (1) in your checkout

For our example we consider that the new language is es_PR, which is based on Spanish (es). For a language not obviously derived from a different one, you can consider it based on US English (en_US).

First, change directory into your fully-prepared checkout. Then execute these commands to clone Spanish, keeping only the PO file:

$ svn copy i18n/es i18n/es_PR
$ cd i18n/es_PR
$ svn rm --force *.stats *.prefs *.pending
$ cd ../..
$ svn copy po/es po/es_PR
$ cd po/es_PR
$ svn rm --force *.stats *.prefs *.pending
$ cd ../..
$ svn ci -m "Created Puerto Rico PO directory using Spain's as a base" i18n/es_PR po/es_PR

New language: (2) in Pootle

Now log into Pootle's PO files repository and make your files available there:

$ ssh translate.creativecommons.org
$ sudo su - pootle
$ cd ~/checkouts/cc_org/cc-i18n-trunk
$ svn up i18n/es_PR po/es_PR

At this point, you should go to http://translate.creativecommons.org/admin/languages.html and ensure the language is associated with the cc_org project (and any others) using the Pootle interface.

New language: (3) update master PO file

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.

Future dreaming

Having changed this English string, run ./bin/sync. This will go through the PO-style PO files and, if translations for a string with that as context exist, either:

  • Migrate the translation to the new English value, or
  • Move the translation out of the PO-style file into the suggestions file, and delete the translation from the PO-style file

I think the second is the better option.

Documentation

Fallback

  •  ?!