Jump to: navigation, search

Difference between revisions of "I18n/Tools"

(Merging script)
(Replaced content with "Category:I18n The contents was moved to https://docs.openstack.org/i18n/latest/tools.html")
 
(10 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
[[Category:I18n]]
 
[[Category:I18n]]
  
I18N uses many different tools, across several OpenStack Projects to meet its goals.
+
The contents was moved to https://docs.openstack.org/i18n/latest/tools.html
 
 
== Tools related with document translation ==
 
 
 
OpenStack documents are in DocBook format. In order to make the document translation management consistent with message translation, we need to convert DocBook into PO format.
 
 
 
The document translation management include following steps:
 
* Slicing: slice DocBook into string segment with a Python script, and generate a PO template
 
* Uploading: Upload the translation resources to Transifex by automation scripts
 
* Translating: manage the translation in Transifex, including the translation memory and glossary management
 
* Merging: merge the translated string into Docbook with a python script
 
* Uploading: Download the translated results by automation scripts.
 
 
 
=== Slicing script ===
 
 
 
The [https://github.com/openstack/openstack-manuals/blob/master/tools/generatepot slicing script] has dependency to package "xml2po". So you have to install gnome-doc-utils before running it. On Ubuntu, do:
 
 
 
<pre><nowiki>
 
sudo apt-get install gnome-doc-utils
 
</nowiki></pre>
 
 
 
or on openSUSE:
 
 
 
<pre><nowiki>
 
sudo zypper install xml2po
 
</nowiki></pre>
 
 
 
The script can scan a specific folder under openstack-manuals/doc/src/docbkx, collect all the text segment in *.xml and combine them into a PO template, with command:
 
 
 
<pre><nowiki>
 
./tools/generatepot [foldername]
 
</nowiki></pre>
 
 
 
The PO template will be put in a "locale" folder under the specific docbook folder, i.e. openstack-manuals/doc/src/docbkx/[bookname]/locale.
 
 
 
=== Merging script ===
 
 
 
The [https://github.com/openstack/openstack-manuals/blob/master/tools/generatedocbook merging script] has dependency to package "xml2po". So you have to install gnome-doc-utils before running it. On Ubuntu, do:
 
 
 
<pre><nowiki>
 
sudo apt-get install gnome-doc-utils
 
</nowiki></pre>
 
 
 
or on openSUSE:
 
 
 
<pre><nowiki>
 
sudo zypper install xml2po
 
</nowiki></pre>
 
 
 
The script can merge the translation strings into DocBook and generate a DocBook in the specific language.
 
 
 
<pre><nowiki>
 
tox -e buildlang -- $LANG
 
</nowiki></pre>
 
 
 
=== Uploading script ===
 
 
 
The uploading script is an automation job running in Jenkins, which will be triggered by "commit" event of openstack-manuals repository. See [https://github.com/openstack-infra/config/blob/master/modules/jenkins/files/slave_scripts/upstream_translation_update_manuals.sh here].
 
 
 
=== Downloading script ===
 
 
 
The downloading script is an automation job running daily in Jenkins. See [https://github.com/openstack-infra/config/blob/master/modules/jenkins/files/slave_scripts/propose_translation_update_manuals.sh here].
 
 
 
== Tools related with message translation ==
 
 
 
For most of the Python projects, the preferred tools for I18N are gettext and babel. The gettext module provides internationalization (I18N) and localization (L10N) services for your Python modules and applications. Babel are a collection of tools for internationalizing Python applications.
 
 
 
You can extract the messages in code to PO template with pybabel:
 
<pre><nowiki>
 
pybabel extract -o nova/locale/nova.pot nova/
 
</nowiki></pre>
 
 
 
=== Uploading script ===
 
 
 
For each Python project in OpenStack, there is an automation job to extract the messages , generate PO template and upload to Transifex, which is triggered by the "commit" event. See [https://github.com/openstack-infra/config/blob/master/modules/jenkins/files/slave_scripts/upstream_translation_update.sh here].
 
 
 
=== Downloading script ===
 
 
 
For each Python project in OpenStack, there is an automation job daily to download the translations in po file to the "locale" folder under the source folder of each project. See [https://github.com/openstack-infra/config/blob/master/modules/jenkins/files/slave_scripts/propose_translation_update.sh here]. It will generate a review request in Gerrit. After review, the translation in po file will be merged.
 

Latest revision as of 14:22, 4 August 2017


The contents was moved to https://docs.openstack.org/i18n/latest/tools.html