potranslator¶
potranslator is a package to easily translate po and pot files generated by Sphinx or other tools in any language supported by Google Translate.
potranslator auto-detects the language in the original pot files and auto-translates the pot files into the supplied target languages.
The Command Line Interface of potranslator and its documentation are based on sphinx-intl.
Facultatif: prend en charge le service collaboratif Transifex pour télécharger les traductions générées automatiquement vers transifex pour les corrections collaboratives des traductions.
Langues supportées¶
- Afrikaans af
- Albanais sq
- Amharic am
- Arabe ar
- Arménien hy
- Azerbaïdjanais az
- Basque eu
- Bélarusse be
- Bengali bn
- Bosniaque bs
- Bulgare bg
- Catalan ca
- Cebuano ceb (ISO-639-2)
- Chinois (simplifié) zh-CN (BCP-47)
- Chinois (traditionnel) zh-TW (BCP-47)
- Corse co
- Croate hr
- Tchèque cs
- Danish da
- Néerlandais nl
- Anglais en
- Esperanto eo
- Estonien et
- Finlandais fi
- Français fr
- Frisien fy
- Galicien gl
- Géorgien Ka
- Allemand de
- Grec el
- Gujarati gu
- Créole Haïtien ht
- Hausa ha
- Hawaïen haw (ISO-639-2)
- Hébreu iw
- Hindi hi
- Hmong hmn (ISO-639-2)
- Hongrois hu
- Islandais is
- Igbo ig
- Indonésien id
- Irlandais ga
- Italien it
- Japonais ja
- Javanais jw
- Kannada kn
- Kazakh kk
- Khmer km
- Coréen ko
- Kurde ku
- Kirghize ky
- Laotien lo
- Latin la
- Letton lv
- Lituanien lt
- Luxembourgeois lb
- Macédonien mk
- Malgache mg
- Malais ms
- Malayalam ml
- Maltais mt
- Maori mi
- Marathi mr
- Mongol mn
- Myanmar (Birmanie) my
- Nepali ne
- Norvégien no
- Nyanja (Chichewa) ny
- Pashtoun ps
- Persan fa
- Polonais pl
- Portugais (Portugal, Brésil) pt
- Punjabi pa
- Roumain ro
- Russe ru
- Samoan sm
- Écossais gaélique gd
- Serbe sr
- Sesotho st
- Shona sn
- Sindhi sd
- Sinhala (Sinhalais) si
- Slovaque sk
- Slovène sl
- Somalien so
- Espagnol es
- Soudanais su
- Swahili sw
- Suédois sv
- Tagalog (Philippin) tl
- Tajik tg
- Tamil ta
- Telugu te
- Thai th
- Turc tr
- Ukrainien uk
- Ourdou ur
- Uzbek uz
- Vietnamien vi
- Gallois cy
- Xhosa xh
- Yiddish yi
- Yoruba yo
- Zulu zu
Quick Start for auto-translation with potranslator¶
This section describes how to translate documents generated by Sphinx with the potranslator command.
Create your document(s) by using Sphinx:
$ sphinx-build -b html /path/to/docs path/to/docs/_build
Optionally add the settings to your conf.py if you have one:
locale_dirs = ['locale/'] #path is an example but this is the recommended path. gettext_compact = False #optional.
locale_dirs est requis et` gettext_compact` est optionnel.
Extract the document’s translatable messages into pot files (make sure you are in the folder containing make.bat and Makefile if you are on windows):
$ make gettext
Translate/Update your documents in German and Japanese:
$ potranslator update -p _build/gettext -l de -l ja
Terminé. Vous avez ces répertoires qui contiennent des fichiers po avec des entrées traduites automatiquement:
./locale/de/LC_MESSAGES/ ./locale/ja/LC_MESSAGES/
Translate/Update your documents in Japanese, build the compiled mo files and generate the translated html documents:
Command line (for Unix systems):
$ potranslator build $ make -e SPHINXOPTS="-D language='ja'" html
Command line (for Windows cmd.exe):
> set SPHINXOPTS=-D language=de > potranslator build > .\make.bat html
Command line (for PowerShell):
> Set-Item env:SPHINXOPTS "-D language=de" > potranslator build > .\make.bat html
C’est tout!
Fonctionnalités de base¶
- Translate from pot files or update existing po files with auto-generated translation.
- Build mo files from translated po or pot files.
Exigences pour les fonctionnalités de base¶
- Python 3.6, 3.5, 3.4, 2.7, pypy.
- external libraries: setuptools, six, babel, click, googletrans, polib
Fonctionnalités optionnelles¶
Ces fonctionnalités nécessitent la bibliothèque transifex-client.
- create a .transifexrc file from an environment variable, without interactive input.
- create a .tx/config file without interactive input.
- update a .tx/config file from locale/pot files automatically.
- Compiler des fichiers mo à partir de fichiers po dans le répertoire locale.
You need to use the tx command to use the following features:
- tx push -s: push pot (catalogues de traduction) vers transifex.
- tx pull -l ja: tire po (catalogues traduits) de transifex.
Exigences pour les fonctionnalités optionnelles¶
- Votre compte transifex si vous voulez télécharger des fichiers po vers transifex.
- librairie externe: transifex-client
Installation¶
It is strongly recommended to use virtualenv for this procedure:
$ pip install potranslator
If you want to use the Optional Features, you need install this additional library:
$ pip install potranslator[transifex]
Commandes, options, variables d’environnement¶
Commandes¶
Tapez potranslator sans arguments pour afficher les instructions d’aide.
Configurer les variables d’environnement¶
All command-line options can be set with environment variables using the format POTRANSLATOR_<UPPER_LONG_NAME> .
Dashes (-) have to replaced with underscores (_).
For example, to set the target languages:
$ export POTRANSLATOR_LANGUAGE=de,ja
On the Windows command line:
> set POTRANSLATOR_LANGUAGE=de,ja
This is the same as passing the option to potranslator directly:
$ potranslator <command> --language=de --language=ja
Configurer sphinx conf.py¶
Add the following settings to your sphinx document’s conf.py if it exists:
locale_dirs = ['locale/'] #for example
gettext_compact = False #optional
Configurer Makefile / make.bat¶
make gettext will generate pot files into the _build/gettext directory, however pot files can be generated in the locale/pot directory if convenient.
You can do that by replacing _build/gettext with locale/pot in your Makefile and/or make.bat that was generated by sphinx-quickstart.
Licence¶
Licencié sous la licence BSD. Voir le fichier LICENCE pour des termes spécifiques.
Original¶
The Command Line Interface and the transifex integration of potranslator are adapted from sphinx-intl.
CHANGEMENTS¶
See: https://github.com/SekouD/potranslator/blob/master/HISTORY.rst