potracionador¶
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.
Opcional: admite el servicio colaborativo Transifex para cargar las traducciones generadas automáticamente a transifex para correcciones colaborativas de las traducciones.
Idiomas admitidos¶
- Afrikaans af
- Cuadrado albanés
- Amárico am
- Arárabe
- Hy armenio
- Az azerbaiyano
- Euskara
- Bielorruso sea
- Bengalí bn
- Bosnio bs
- Bg búlgaro
- Catalán ca
- Ceb Cebuano (ISO-639-2)
- Chino (simplificado) zh-CN (BCP-47)
- Chino (tradicional) zh-TW (BCP-47)
- Corsican co
- Hora croata
- Checo cs
- Danés da
- Holandés nl
- Inglés en
- Esperanto eo
- Estonio et
- Finlandés fi
- Franco francés
- Frisian fy
- Gl Gallego
- Ka georgiano
- Alemán de
- El griego
- Gujarati gu
- Criollo haitiano ht
- Hausa ha
- Haw hawaiano (ISO-639-2)
- Hebreo iw
- Hindi hola
- Hmong hmn (ISO-639-2)
- Húngaro hu
- Islandés es
- Igbo ig
- ID indonesio
- Ga irlandés
- Italiano
- Ja japonesa
- Javanés jw
- Kannada kn
- Kazajo kk
- Km Khmer
- Ko coreano
- Kurdo ku
- Kyrgyz ky
- Lao lo
- La Latina
- Letón lv
- Lituano lt
- Libra Luxemburguesa
- Macedonio mk
- Mg malgache
- Malay ms
- Malayalam ml
- Malta mt
- Maori mi
- Marathi mr
- Mongol mn
- Myanmar (Birmano) mi
- Nepali ne
- Noruego no
- Nyanja (Chichewa) ny
- Pashto ps
- Fa persa
- Polaco f pl
- Portugués (Portugal, Brasil) pt
- Punjabi pa
- Rumano
- Ru ruso
- Samoan sm
- Scots Gaelic gd
- Serbio sr
- Sesotho st
- Shona sn
- Sindhi sd
- Sinhala (Sinhalese) si
- Eslovaco sk
- Esloveno sl
- Somalí entonces
- Español es
- Sundanese su
- Swahili sw
- Sv sueco
- Tagalo (filipino) tl
- Tajik tg
- Tamil ta
- Telugu te
- Th tailandés
- Turco tr
- Uk ucraniano
- Urdu ur
- Uz uz
- Vietnamita vi
- Welsh 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 es obligatorio y` gettext_compact` es opcional.
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
Hecho. Obtuvo estos directorios que contienen archivos po con entradas traducidas automáticamente:
./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
¡Eso es todo!
Caracteristicas basicas¶
- Translate from pot files or update existing po files with auto-generated translation.
- Build mo files from translated po or pot files.
Requisitos para las características básicas¶
- Python 3.6, 3.5, 3.4, 2.7, pypy.
- external libraries: setuptools, six, babel, click, googletrans, polib
Características opcionales¶
Estas características necesitan la biblioteca 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.
- compilar archivos mo desde archivos po en el directorio de configuración regional.
You need to use the tx command to use the following features:
- tx push -s: push pot (catálogos de traducción) a transifex.
- tx pull -l ja: pull po (catálogos traducidos) de transifex.
Requisitos para las características opcionales¶
- Su cuenta transifex si desea cargar / descargar archivos po de transifex.
- biblioteca externa: transifex-client
Instalación¶
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]
Comandos, opciones, variables de entorno¶
Comandos¶
Escriba potraslator sin argumentos para mostrar las instrucciones de ayuda.
Configurar variables de entorno¶
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
Configuración 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
Configurar 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.
Licencia¶
Licencia bajo la licencia BSD. Consulte el archivo LICENCIA para conocer los términos específicos.
Original¶
The Command Line Interface and the transifex integration of potranslator are adapted from sphinx-intl.