Update the draft of Sphinx Document Translation Guide

This commit is contained in:
Nozomu Kaneko 2013-04-03 03:25:53 +09:00
parent d7e6ab3cfc
commit c505f70439

View File

@ -4,12 +4,13 @@ Sphinx Document Translation Guide
.. topic:: Abstract .. topic:: Abstract
This document describes the translation cycle of Sphinx based document. This document describes the translation cycle of Sphinx-based document.
As the subject, use Sphinx document its self. For illustrative purpose, we use Sphinx document itself in this document.
The Sphinx document is included in the Sphinx code and that managed using The Sphinx document is included in the Sphinx code. It is managed by
`Mercurial`_ and is hosted on `BitBucket`_. `Mercurial`_ and is hosted on `BitBucket`_.
hg clone https://bitbucket.org/birkenfeld/sphinx hg clone https://bitbucket.org/birkenfeld/sphinx
@ -41,9 +42,9 @@ These are the basic steps needed to start translating the Sphinx document.
locale_dirs = ['locale/'] #for example locale_dirs = ['locale/'] #for example
gettext_compact = False #optional gettext_compact = False #optional
This case-study postulate :confval:`locale_dirs` set to 'locale/' and This case-study assumes that :confval:`locale_dirs` is set to 'locale/' and
:confval:`gettext_compact` set to `False` (the Sphinx document is :confval:`gettext_compact` is set to `False` (the Sphinx document is
configured as such). already configured as such).
#. Generate pot files from the document. #. Generate pot files from the document.
@ -64,9 +65,10 @@ These are the basic steps needed to start translating the Sphinx document.
#. Generate po files from pot files. #. Generate po files from pot files.
Sphinx expects translated po files under ``locale/<lang>/LC_MESSAGES/`` Sphinx expects that translated po files are under
directory. For the Japanese, you need ``locale/ja/LC_MESSAGE/`` and ``locale/<lang>/LC_MESSAGES/`` directory. For Japanese, you need
po files copy and renamed from pot files: ``locale/ja/LC_MESSAGE/`` directory and po files under the
directory. The po files can be copied and renamed from pot files:
.. code-block:: bash .. code-block:: bash
@ -124,19 +126,21 @@ These are the basic steps needed to start translating the Sphinx document.
msgfmt builders.po -o builders.mo msgfmt builders.po -o builders.mo
... ...
in one command: in one line:
find . -name "*.po" -type f -print0 |while read -r -d '' file; do .. code-block:: bash
msgfmt "$file" -o "${file%.*}.mo";
find . -name "*.po" -type f -print0 | while read -r -d '' file; do \
msgfmt "$file" -o "${file%.*}.mo"; \
done done
#. Make translated html (or other format). #. Make translated html (or other format).
Now you was ready to make the translated document in the Now you are ready to make the translated document by the
:command:`make html` command. You need :confval:`language` parameter in :command:`make html` command. You need :confval:`language` parameter in
``conf.py`` or you may also be specified the parameter on the command line. ``conf.py`` or you may also specify the parameter on the command line.
.. code-block:: bash .. code-block:: bash
@ -150,8 +154,8 @@ These are the basic steps needed to start translating the Sphinx document.
Update your po files by new pot files Update your po files by new pot files
-------------------------------------- --------------------------------------
If the document is updated, it is necessary to generate a updated pot files If the document is updated, it is necessary to generate updated pot files
and to apply difference to translated po file. and to apply differences to translated po files.
In order to apply the updating difference of a pot file to po file, In order to apply the updating difference of a pot file to po file,
using msgmerge_ command. using msgmerge_ command.
@ -182,9 +186,9 @@ Make new translation project
2. Create new project for your document. 2. Create new project for your document.
In the current transifex, since one translation project cannot treat two Currently, transifex does not allow for a translation project to
or more version of a document, a version number is included in a project have more than one version of document, so you'd better include a
name. version number in your project name.
For example: For example:
@ -219,14 +223,14 @@ Create config files for tx command
Updating /home/ubuntu/.transifexrc file... Updating /home/ubuntu/.transifexrc file...
Done. Done.
This process will create ``~/.transifexrc`` file that include auth This process will create ``.tx/config`` in the current directory, as
information and create ``.tx/config`` in current directory. well as ``~/.transifexrc`` file that includes auth information.
..... .....
registration pot files in transifex Register pot files in transifex
----------------------------------- -----------------------------------
.. code-block:: bash .. code-block:: bash
@ -285,7 +289,7 @@ Tranlating Tips
* Translating local vs Transifex * Translating local vs Transifex
If you want to push all language's po files, you can use `tx push -t`. If you want to push all language's po files, you can use `tx push -t`.
(this operatoin overwrite translations in transifex.) (this operation overwrites translations in transifex.)
* rebuild * rebuild
@ -296,8 +300,8 @@ Tranlating Tips
Contributing to Sphinx reference translation Contributing to Sphinx reference translation
============================================ ============================================
The recommended way for new contributors to translate to Sphinx reference The recommended way for new contributors to translate Sphinx reference
is to join a translation team on Transifex. is to join the translation team on Transifex.
There is `sphinx translation page`_ for Sphinx-1.2 document. There is `sphinx translation page`_ for Sphinx-1.2 document.