Package: potranslator
potranslatoris a package to easily translate po and pot files generated bySphinxor other tools in any language supported by Google Translate.potranslatorauto-detects the language in the original pot files and auto-translates the pot files into the supplied target languages.The Command Line Interface ofpotranslatorand its documentation are based onsphinx-intl.Optional: supports the Transifex collaborative service to upload the auto-generated translations totransifexfor collaborative corrections of the translations.Supported LanguagesAfrikaans     afAlbanian      sqAmharic       amArabic        arArmenian      hyAzeerbaijani  azBasque        euBelarusian    beBengali       bnBosnian       bsBulgarian     bgCatalan       caCebuano       ceb (ISO-639-2)Chinese (Simplified)  zh-CN (BCP-47)Chinese (Traditional) zh-TW (BCP-47)Corsican      coCroatian      hrCzech csDanish        daDutch nlEnglish       enEsperanto     eoEstonian      etFinnish       fiFrench        frFrisian       fyGalician      glGeorgian      kaGerman        deGreek elGujarati      guHaitian Creole        htHausa haHawaiian      haw (ISO-639-2)Hebrew        iwHindi hiHmong hmn (ISO-639-2)Hungarian     huIcelandic     isIgbo  igIndonesian    idIrish gaItalian       itJapanese      jaJavanese      jwKannada       knKazakh        kkKhmer kmKorean        koKurdish       kuKyrgyz        kyLao   loLatin laLatvian       lvLithuanian    ltLuxembourgish lbMacedonian    mkMalagasy      mgMalay msMalayalam     mlMaltese       mtMaori miMarathi       mrMongolian     mnMyanmar (Burmese)     myNepali        neNorwegian     noNyanja (Chichewa)     nyPashto        psPersian       faPolish        plPortuguese (Portugal, Brazil) ptPunjabi       paRomanian      roRussian       ruSamoan        smScots Gaelic  gdSerbian       srSesotho       stShona snSindhi        sdSinhala (Sinhalese)   siSlovak        skSlovenian     slSomali        soSpanish       esSundanese     suSwahili       swSwedish       svTagalog (Filipino)    tlTajik tgTamil taTelugu        teThai  thTurkish       trUkrainian     ukUrdu  urUzbek uzVietnamese    viWelsh cyXhosa xhYiddish       yiYoruba        yoZulu  zuQuick Start for auto-translation with potranslatorThis section describes how to translate documents generated bySphinxwith thepotranslatorcommand.Create your document(s) by using Sphinx:$sphinx-build-bhtml/path/to/docspath/to/docs/_buildOptionally add the settings to yourconf.pyif you have one:locale_dirs=['locale/']#path is an example but this is the recommended path.gettext_compact=False#optional.locale_dirsis required andgettext_compactis optional.Extract the document’s translatable messages into pot files (make sure you are in the folder containingmake.batandMakefileif you are on windows):$makegettextTranslate/Update your documents in German and Japanese:$potranslatorupdate-p_build/gettext-lde-ljaDone. You got these directories that contain po files with auto-translated entries:./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):$potranslatorbuild$make-eSPHINXOPTS="-D language='ja'"htmlCommand line (for Windows cmd.exe):> set SPHINXOPTS=-D language=de
> potranslator build
> .\make.bat htmlCommand line (for PowerShell):> Set-Item env:SPHINXOPTS "-D language=de"
> potranslator build
> .\make.bat htmlThat’s all!Basic FeaturesTranslate from pot files or update existing po files with auto-generated translation.Build mo files from translated po or pot files.Requirements for the basic featuresPython 3.6, 3.5, 3.4, 2.7, pypy.external libraries:setuptools,six,babel,click,googletrans,polibOptional featuresThese features need thetransifex-clientlibrary.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.build mo files from po files in the locale directory.You need to use thetxcommand to use the following features:tx push -s: push pot (translation catalogs) to transifex.tx pull -l ja: pull po (translated catalogs) from transifex.Requirements for the optional featuresYourtransifexaccount if you want to upload/download po files from transifex.external library:transifex-clientInstallationIt is strongly recommended to use virtualenv for this procedure:$pipinstallpotranslatorIf you want to use theOptional Features, you need install this additional library:$pipinstallpotranslator[transifex]Commands, options, environment variablesCommandsTypepotranslatorwithout arguments to show the help instructions.Setup environment variablesAll 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:$exportPOTRANSLATOR_LANGUAGE=de,jaOn the Windows command line:> set POTRANSLATOR_LANGUAGE=de,jaThis is the same as passing the option to potranslator directly:$potranslator<command>--language=de--language=jaSetup sphinx conf.pyAdd the following settings to your sphinx document’s conf.py if it exists:locale_dirs=['locale/']#for examplegettext_compact=False#optionalSetup Makefile / make.batmake gettextwill generate pot files into the_build/gettextdirectory,
however pot files can be generated in thelocale/potdirectory if convenient.You can do that by replacing_build/gettextwithlocale/potin yourMakefileand/ormake.batthat was generated by sphinx-quickstart.LicenseLicensed under the BSD license.
See the LICENSE file for specific terms.OriginalThe Command Line Interface and thetransifexintegration ofpotranslatorare adapted fromsphinx-intl.https://pypi.org/project/sphinx-intlCHANGESSee:https://github.com/SekouD/potranslator/blob/master/HISTORY.rstHistory1.1.0 (2018-07-08)Now uses importlib_ressources for faster startup from CLI.Updated the command line usability.Added Type Annotation compliant with PEP 561.Updated Documentation.1.0.5 (2018-07-06)Updated Documentation.Translated the documentation in French, Spanish, Italian, German, Italian, Japanese and Chinese.More detailed updates to the po files meta-data.1.0.0 (2018-07-05)First release candidate.Added Command Line Interface.0.1.0 (2018-06-27)First release on PyPI.