壷主

Pypi Python Package Index Status Linux Continuous Integration Status Windows Continuous Integration Status Documentation Status Depedencies Update Status Python 3 Readiness Code Coverage Status Code Vulnerability Status

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.

オプション:Transifexコラボレーションサービスをサポートし、自動生成された翻訳をtransifex_にアップロードし、翻訳の共同修正を行います。

サポートされている言語

  • アフリカーンス語
  • アルバニア語sq
  • アムハリックアム
  • アラビア語
  • アルメニア語
  • アゼルバイジャン
  • バスク語
  • ベラルーシ語
  • ベンガル
  • ボスニア語BS
  • ブルガリア語bg
  • カタロニア語
  • Cebuano ceb(ISO-639-2)
  • 中国語(簡体字)zh-CN(BCP-47)
  • 中国語(繁体字)zh-TW(BCP-47)
  • コルシカ島の共同
  • クロアチア語hr
  • チェコのCS
  • デンマーク語da
  • オランダ語nl
  • 英語
  • エスペラント
  • エストニア語
  • フィンランドのfi
  • フランス語fr
  • フリジア語fy
  • ガリシア語gl
  • ジョージアカ
  • ドイツ語
  • ギリシャ語el
  • Gujarati gu
  • ハイチ語クレオールht
  • ハウサハハ
  • ハワイアンハワイ(ISO-639-2)
  • ヘブライ語
  • ヒンディー語hi
  • Hmong hmn(ISO-639-2)
  • ハンガリー語
  • アイスランド語は
  • イボig
  • インドネシアの国籍
  • アイリッシュガ
  • イタリア語
  • 日本のジャ
  • ジャワ語
  • カンナダ
  • カザフスタン
  • クメールkm
  • 韓国語
  • クルド語
  • キルギスキ
  • ラオウ
  • ラテンラ
  • ラトビア語lv
  • リトアニア語lt
  • ルクセンブルクポンド
  • マケドニア語mk
  • マダガスカルmg
  • マレー語ms
  • マラヤーラム
  • マルタ
  • マオリミ
  • Marathi mr
  • モンゴル人
  • ミャンマー(ビルマ)私
  • ネパール
  • ノルウェーのno
  • ニャンジャ(チチェワ)ny
  • パシュトウソス
  • ペルシア語
  • ポーランド語pl
  • ポルトガル語(ポルトガル、ブラジル)pt
  • パンジャブパ
  • ルーマニア語ro
  • ロシア語ru
  • サモアムス
  • スコット・ゲール語gd
  • セルビア語sr
  • セソト
  • ショーナン
  • シンディーSD
  • シンハラ(シンハラ語)
  • スロバキア語のsk
  • スロベニア語sl
  • ソマリア
  • スペイン語es
  • スンダ語
  • スワヒリ語sw
  • スウェーデンのsv
  • タガログ語(フィリピン語)
  • タジク
  • タミル語
  • Telugu te
  • タイ語
  • トルコ語tr
  • ウクライナの英国
  • ウルドゥー語
  • ウズベキスタン
  • ベトナム語vi
  • ウェールズ語
  • コーサXH
  • イディッシュイー
  • ヨルバヨ
  • ズールー族

Quick Start for auto-translation with potranslator

This section describes how to translate documents generated by Sphinx with the potranslator command.

  1. Create your document(s) by using Sphinx:

    $ sphinx-build -b html /path/to/docs path/to/docs/_build
    
  2. 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`は必須で、 gettext_compact`はオプションです。

  3. 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
    
  4. Translate/Update your documents in German and Japanese:

    $ potranslator update -p _build/gettext -l de -l ja
    

    完了しました。自動的に翻訳されたエントリを持つpoファイルを含むこれらのディレクトリがあります:

    ./locale/de/LC_MESSAGES/
    ./locale/ja/LC_MESSAGES/
    
  5. 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
    

それで全部です!

基本的な機能

  • Translate from pot files or update existing po files with auto-generated translation.
  • Build mo files from translated po or pot files.

基本機能の要件

オプション機能

これらの機能には `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.
  • ロケールディレクトリのpoファイルからmoファイルをビルドします。

You need to use the tx command to use the following features:

  • tx push -s:ポット(翻訳カタログ)をtransifexにプッシュします。
  • tx pull -l ja:transifexからpo(翻訳カタログ)を引き出します。

オプション機能の要件

  • transifexからpoファイルをアップロード/ダウンロードする場合は、transifex_アカウントを使用します。
  • 外部ライブラリ: transifex-client

インストール

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]

コマンド、オプション、環境変数

コマンド

help命令を表示するには、引数なしで `potranslator`とタイプしてください。

環境変数の設定

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

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

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.

ライセンス

BSDライセンスの下でライセンスされています。特定の用語については、LICENSEファイルを参照してください。

元の

The Command Line Interface and the transifex integration of potranslator are adapted from sphinx-intl.