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.
Opzionale: supporta il servizio collaborativo Transifex per caricare le traduzioni generate automaticamente in transifex per le correzioni collaborative delle traduzioni.
Lingue supportate¶
- Afrikaans af
- Sq. Albanese
- Amarico
- Arabo ar
- Armeno hy
- Az azero
- Eu basco
- Essere bielorusso
- Bn bengalese
- Bosniaco bs
- Bulgaro bg
- Catalano ca
- Cebuano ceb (ISO-639-2)
- Cinese (semplificato) zh-CN (BCP-47)
- Cinese (tradizionale) zh-TW (BCP-47)
- Co corso
- Croato
- Cs ceco
- Danese
- Nl olandesi
- Inglese en
- Esperanto eo
- Estone et
- Finlandese fi
- Francese
- Frisone
- Galiziano gl
- Ka georgiano
- Tedesco de
- El greco
- Gujarati gu
- Creolo haitiano ht
- Hausa ha
- Haw hawaiian (ISO-639-2)
- Iw ebraico
- Ciao Hindi
- Hmong hmn (ISO-639-2)
- Ungherese
- L’islandese è
- Igbo ig
- Id indonesiano
- Ga ga
- Italiano
- Giapponese ja
- Jw giavanese
- Kannada kn
- Kazako kk
- Khmer km
- Ko coreano
- Ku curdo
- Kyrgyz ky
- Lao lo
- La latina
- Lettone lv
- Lituano lt
- Lb lussemburghese
- Mk macedone
- Mg malgascio
- Ms malese
- Malayalam ml
- Maltese mt
- Maori mi
- Marathi signor
- Mn mongolo
- Myanmar (Birmano) mio
- Nepalese
- Norvegese no
- Nyanja (Chichewa), ny
- Pashto ps
- Fa persiano
- Polacco pl
- Portoghese (Portogallo, Brasile) pt
- Punjabi pa
- Rumeno ro
- Russo ru
- Samoano sm
- Gaelico scozzese gd
- Sr. Serbo
- Sesotho st
- Shona sn
- Sindhi sd
- Sinhala (singalese) si
- Slovacca sk
- Sloveno sl
- Somalo così
- Spagnolo es
- Sugherese
- Swahili sw
- Sv svedese
- Tagalog (filippino) tl
- Tagico tg
- Tamil ta
- Telugu te
- Th tailandese
- Turco tr
- Uk ucraino
- Urdu
- Uzbeko 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 è richiesto e` gettext_compact` è facoltativo.
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
Fatto. Hai queste directory che contengono file po con voci auto-tradotte:
./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
È tutto!
Caratteristiche di base¶
- Translate from pot files or update existing po files with auto-generated translation.
- Build mo files from translated po or pot files.
Requisiti per le funzionalità di base¶
- Python 3.6, 3.5, 3.4, 2.7, pypy.
- external libraries: setuptools, six, babel, click, googletrans, polib
Caratteristiche opzionali¶
Queste funzionalità richiedono la libreria 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.
- crea file mo da file po nella directory locale.
You need to use the tx command to use the following features:
- tx push -s: push pot (cataloghi di traduzione) su transifex.
- tx pull -l ja: pull po (cataloghi tradotti) da transifex.
Requisiti per le funzionalità opzionali¶
- Il tuo account transifex se vuoi caricare / scaricare file po da transifex.
- libreria esterna: transifex-client
Installazione¶
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]
Comandi, opzioni, variabili d’ambiente¶
comandi¶
Digita potranslator senza argomenti per mostrare le istruzioni di aiuto.
Imposta le variabili d’ambiente¶
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
Imposta 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
Imposta 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.
Licenza¶
Autorizzato con la licenza BSD. Vedere il file LICENSE per termini specifici.
Originale¶
The Command Line Interface and the transifex integration of potranslator are adapted from sphinx-intl.
I CAMBIAMENTI¶
See: https://github.com/SekouD/potranslator/blob/master/HISTORY.rst