small fixes in intl document

This commit is contained in:
Georg Brandl 2014-01-10 21:25:59 +01:00
parent 4c91a7a1d2
commit 8b2417bc6d
2 changed files with 24 additions and 20 deletions

View File

@ -71,7 +71,7 @@ Translating with sphinx-intl
---------------------------- ----------------------------
Quick guide Quick guide
^^^^^^^^^^^^ ^^^^^^^^^^^
`sphinx-intl`_ is a useful tool to work with Sphinx translation flow. `sphinx-intl`_ is a useful tool to work with Sphinx translation flow.
This section describe a easy way to translate with sphinx-intl. This section describe a easy way to translate with sphinx-intl.
@ -108,19 +108,18 @@ This section describe a easy way to translate with sphinx-intl.
#. Build mo files and make translated document. #. Build mo files and make translated document.
You need :confval:`language` parameter in ``conf.py`` or you may also You need a :confval:`language` parameter in ``conf.py`` or you may also
specify the parameter on the command line:: specify the parameter on the command line::
$ sphinx-intl build $ sphinx-intl build
$ make -e SPHINXOPTS="-D language='de'" html $ make -e SPHINXOPTS="-D language='de'" html
Congratulations! You got the translated documentation in the ``_build/html``
Congratulations!! You got the translated document in ``_build/html``
directory. directory.
Translating Translating
^^^^^^^^^^^^ ^^^^^^^^^^^
Translate po file under ``./locale/de/LC_MESSAGES`` directory. Translate po file under ``./locale/de/LC_MESSAGES`` directory.
The case of builders.po file for sphinx document: The case of builders.po file for sphinx document:
@ -146,16 +145,17 @@ syntax:
"FILL HERE BY TARGET LANGUAGE FILL HERE BY TARGET LANGUAGE FILL HERE " "FILL HERE BY TARGET LANGUAGE FILL HERE BY TARGET LANGUAGE FILL HERE "
"BY TARGET LANGUAGE :ref:`EXTENSIONS <extensions>` FILL HERE." "BY TARGET LANGUAGE :ref:`EXTENSIONS <extensions>` FILL HERE."
Please be careful not to break reST notation. Please be careful not to break reST notation. Most po-editors will help you
with that.
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 updated pot files If a document is updated, it is necessary to generate updated pot files
and to apply differences to translated po files. 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 :command:`sphinx-intl update` command. use the :command:`sphinx-intl update` command.
.. code-block:: bash .. code-block:: bash
@ -165,6 +165,10 @@ using :command:`sphinx-intl update` command.
Using Transifex service for team translation Using Transifex service for team translation
-------------------------------------------- --------------------------------------------
`Transifex <http://transifex.com>`_ is one of several services that allow
collaborative translation via a web interface. It has a nifty Python-based
command line client that makes it easy to fetch and push translations.
.. TODO: why use transifex? .. TODO: why use transifex?
@ -181,9 +185,9 @@ Using Transifex service for team translation
#. Create your transifex_ account and create new project for your document #. Create your transifex_ account and create new project for your document
Currently, transifex does not allow for a translation project to Currently, transifex does not allow for a translation project to have more
have more than one version of document, so you'd better include a than one version of the document, so you'd better include a version number in
version number in your project name. your project name.
For example: For example:
@ -193,8 +197,8 @@ Using Transifex service for team translation
#. Create config files for tx command #. Create config files for tx command
This process will create ``.tx/config`` in the current directory, as This process will create ``.tx/config`` in the current directory, as well as
well as ``~/.transifexrc`` file that includes auth information. a ``~/.transifexrc`` file that includes auth information.
.. code-block:: bash .. code-block:: bash
@ -253,11 +257,11 @@ Using Transifex service for team translation
That's all! That's all!
.. tip:: Translating on local and Transifex .. tip:: Translating locally and on Transifex
If you want to push all language's po files, you can be done by using If you want to push all language's po files, you can be done by using
:command:`tx push -t` command. :command:`tx push -t` command.
Watch out! this operation overwrites translations in transifex. Watch out! This operation overwrites translations in transifex.
In other words, if you have updated each in the service and local po files, In other words, if you have updated each in the service and local po files,
it would take much time and effort to integrate them. it would take much time and effort to integrate them.
@ -270,7 +274,7 @@ Contributing to Sphinx reference translation
The recommended way for new contributors to translate Sphinx reference The recommended way for new contributors to translate Sphinx reference
is to join the 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 documentation.
1. Login to transifex_ service. 1. Login to transifex_ service.
2. Go to `sphinx translation page`_. 2. Go to `sphinx translation page`_.

View File

@ -215,7 +215,7 @@ def init(locale_dirs, language, catalog='sphinx'):
except Exception: except Exception:
# Language couldn't be found in the specified path # Language couldn't be found in the specified path
pass pass
# guarantee translations[catalog] exists # guarantee translators[catalog] exists
if translator is None: if translator is None:
translator = gettext.NullTranslations() translator = gettext.NullTranslations()
has_translation = False has_translation = False