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.
Optional: unterstützt den Transifex-Collaboration-Service zum Hochladen der automatisch generierten Übersetzungen in transifex für kollaborative Korrekturen der Übersetzungen.
Unterstützte Sprachen¶
- Afrikaans af
- Albanisch sq
- Amharisch bin
- Arabisch ar
- Armenisch hy
- Aserbaidschanische az
- Baskische eu
- Belarussisch sein
- Bengalisch
- Bosnisch bs
- Bulgarisch
- Katalanisch ca
- Cebuano ceb (ISO-639-2)
- Chinesisch (vereinfacht) zh-CN (BCP-47)
- Chinesisch (traditionell) zh-TW (BCP-47)
- Korsische co
- Kroatische hr
- Tschechische cs
- Dänisch da
- Holländische nl
- Englisch en
- Esperanto eo
- Estnisch et
- Finnische fi
- Französisch fr
- Friesisch fy
- Galizisch gl
- Georgischer Ka
- Deutsch de
- Griechischer el
- Gujarati gu
- Haitianische kreolische ht
- Hausa ha
- Hawaiianer (ISO-639-2)
- Hebräisch
- Hindi Hallo
- Hmong hmn (ISO-639-2)
- Ungarischer hu
- Isländisch ist
- Igbo ig
- Indonesische ID
- Irisches ga
- Italienisch es
- Japanisch ja
- Javanisch jw
- Kannada kn
- Kasachisch kk
- Khmer km
- Koreanisch ko
- Kurdisch ku
- Kyrgyz ky
- Lao lo
- Lateinisch la
- Lettisch lv
- Litauisch lt
- Luxemburgisch lb
- Mazedonische mk
- Madagassische mg
- Malaiische Frau
- Malayalam ml
- Maltesisch mt
- Maori mi
- Marathi Herr
- Mongolische mn
- Myanmar (Birmanisch) mein
- Nepali ne
- Norwegische Nr
- Nyanja (Chichewa) NY
- Paschtu ps
- Persische Fa
- Polnisch pl
- Portugiesisch (Portugal, Brasilien) pt
- Punjabi pa
- Rumänisch
- Russisch ru
- Samoanische Kl
- Schottisches Gälisch gd
- Serbisch sr
- Sesotho st
- Shona sn
- Sindhi sd
- Singhalesisch (Singhalesisch) si
- Slowakisch
- Slowenisch
- Somali so
- Spanisch es
- Sundanesische su
- Swahili sw
- Schwedisch sv
- Tagalog (Filipino) tl
- Tadschikisch tg
- Tamilisch ta
- Telugu te
- Thailändischer Th
- Türkische tr
- Ukrainisch uk
- Urdu ur
- Usbekische Uz
- Vietnamesisch vi
- Welsh cy
- Xhosa xh
- Jiddisch 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 ist erforderlich und` gettext_compact` ist optional.
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
Erledigt. Sie haben diese Verzeichnisse, die PO-Dateien mit automatisch übersetzten Einträgen enthalten:
./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
Das ist alles!
Grundfunktionen¶
- Translate from pot files or update existing po files with auto-generated translation.
- Build mo files from translated po or pot files.
Anforderungen für die grundlegenden Funktionen¶
- Python 3.6, 3.5, 3.4, 2.7, Pypy.
- external libraries: setuptools, six, babel, click, googletrans, polib
Optionale Funktionen¶
Diese Funktionen benötigen die Bibliothek 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.
- Erstellen Sie MO-Dateien aus Po-Dateien im Gebietsschema-Verzeichnis.
You need to use the tx command to use the following features:
- tx push -s: Push-Pot (Übersetzungskataloge) nach transifex.
- tx pull -l ja: ziehe po (übersetzte Kataloge) von transifex.
Anforderungen für die optionalen Funktionen¶
- Ihr transifex Konto, wenn Sie po-Dateien von transifex hochladen / herunterladen möchten.
- externe Bibliothek: 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]
Befehle, Optionen, Umgebungsvariablen¶
Befehle¶
Geben Sie potranslator ohne Argumente ein, um die Hilfeanweisungen anzuzeigen.
Setup-Umgebungsvariablen¶
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
Richten Sie sphinx conf.py ein¶
Add the following settings to your sphinx document’s conf.py if it exists:
locale_dirs = ['locale/'] #for example
gettext_compact = False #optional
Setup 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.
Lizenz¶
Lizenziert unter der BSD-Lizenz. Spezifische Bedingungen finden Sie in der LIZENZDATEI.
Original¶
The Command Line Interface and the transifex integration of potranslator are adapted from sphinx-intl.
ÄNDERUNGEN¶
See: https://github.com/SekouD/potranslator/blob/master/HISTORY.rst