Sphinx utility that make it easy to translate and to apply translation.
Project description
sphinx-intl is a utility tool that provides several features that make it easy to translate and to apply translation to Sphinx generated document. Optional: support the Transifex service for translation with Sphinx .
QuickStart for sphinx translation
This section describe to translate with Sphinx and sphinx-intl command.
Create your document by using Sphinx.
Add configurations to your conf.py:
locale_dirs = ['locale/'] #path is example but recommended. gettext_compact = False #optional.
locale_dirs is required and gettext_compact is optional.
Extract document’s translatable messages into pot files:
$ make gettext
Setup/Update your locale_dir:
$ sphinx-intl update -p _build/locale -l de -l ja
Done. You got these directories that contain po files:
./locale/de/LC_MESSAGES/
./locale/ja/LC_MESSAGES/
Translate your po files under ./locale/<lang>/LC_MESSAGES/.
Build mo files and make translated document:
$ sphinx-intl build $ make -e SPHINXOPTS="-D language='ja'" html
That’s all!
Basic Features
create or update po files from pot files.
build mo files from po files.
Requirements for basic
Python 3.6, 3.5, 3.4, 2.7, pypy.
external library: setuptools, six, babel, click
Optional features
These features need transifex-client library.
create .transifexrc file from environment variable, without interactive input.
create .tx/config file without interactive input.
update .tx/config file from locale/pot files automatically.
build mo files from po files in the locale directory.
You need to use tx command for below features:
tx push -s : push pot (translation catalogs) to transifex.
tx pull -l ja : pull po (translated catalogs) from transifex.
Requirements for optional
Your transifex account if you want to download po files from transifex or you want to translate on transifex.
external library: transifex-client
Installation
Recommend strongly: use virtualenv for this procedure:
$ pip install sphinx-intl
If you want to use Optional Features, you need install additional library:
$ pip install sphinx-intl[transifex]
Commands, options, environment variables
Commands
Type sphinx-intl without arguments, options to show command help.
Setup environment variables
All command-line options can be set with environment variables using the format SPHINXINTL_<UPPER_LONG_NAME> . Dashes (-) have to replaced with underscores (_).
For example, to set the languages:
export SPHINXINTL_LANGUAGE=de,ja
This is the same as passing the option to sphinx-intl directly:
sphinx-intl <command> --language=de --language=ja
Setup sphinx conf.py
Add below settings to sphinx document’s conf.py if not exists:
locale_dirs = ['locale/'] #for example gettext_compact = False #optional
Setup Makefile / make.bat
make gettext will generate pot files into _build/locale directory, however pot files should be generated in the locale/pot is convenient. You can be done by replacing _build/locale with locale/pot in your Makefile and/or make.bat that was generated by sphinx-quickstart.
License
Licensed under the BSD license. See the LICENSE file for specific terms.
Original
This utilty derived from these projects.
CHANGES
See: https://github.com/sphinx-doc/sphinx-intl/blob/master/CHANGES
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sphinx-intl-0.9.11.tar.gz
.
File metadata
- Download URL: sphinx-intl-0.9.11.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d80719be2faf33b958e52ca79cba697625e0eb10fd857eb5e8882eae7fb338f5 |
|
MD5 | ef4494c014ae7a575e1d4f77c5c7834b |
|
BLAKE2b-256 | bb52526339a2686ab40759f875e6ea98e303a4b9536bcbd046b02c2a07c81fca |
File details
Details for the file sphinx_intl-0.9.11-py2.py3-none-any.whl
.
File metadata
- Download URL: sphinx_intl-0.9.11-py2.py3-none-any.whl
- Upload date:
- Size: 15.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4584a7338028bceecad46c0023bc1d0ed766e96c9f7dfef06cfbacf6792d460 |
|
MD5 | 36b27d00f8681ce95e8218ee536376fa |
|
BLAKE2b-256 | 73cce7386afd4ce1003a5ef1129a404d405ba578dbae7067db21312a5d5c23fd |