翻訳者のドキュメントへようこそ!¶
内容:
壷主¶
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.
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`は必須で、 gettext_compact`はオプションです。
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
完了しました。自動的に翻訳されたエントリを持つpoファイルを含むこれらのディレクトリがあります:
./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
それで全部です!
基本的な機能¶
- Translate from pot files or update existing po files with auto-generated translation.
- Build mo files from translated po or pot files.
基本機能の要件¶
- Python 3.6,3.5,3.4,2.7、pypy。
- external libraries: setuptools, six, babel, click, googletrans, polib
オプション機能¶
これらの機能には `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]
コマンド、オプション、環境変数¶
環境変数の設定¶
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.
インストール¶
安定したリリース¶
potranslatorをインストールするには、端末で次のコマンドを実行します。
$ pip install potranslator
これは、常に最新の安定版リリースをインストールするため、翻訳者をインストールするのに推奨される方法です。
If you want to use the Optional Features, you need to install this additional library transifex-client:
$ pip install potranslator[transifex]
pip`がインストールされていない場合、この Python installation guide`_がプロセスを案内します。
使用法¶
Pythonプログラムから¶
To use potranslator in a python project:
from potranslator import PoTranslator
languages = ('fr', 'es', 'it')
translator = PoTranslator(pot_dir='path/to/pot_dir', locale_dir='path/to/locale_dir')
results = translator.translate_all_pot(src_lang='en', target_langs=languages, auto_save=False)
コマンド、オプション、環境変数¶
Basic Usage¶
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 is required and gettext_compact is 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
Done. 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):
$ 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
That's all!
環境変数の設定¶
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 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 _build/gettext directory, however pot files can be generated in the locale/pot 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.
翻訳者のためのApiドキュメンテーションパッケージ¶
potranslator.potranslator.pyのクラスのAPIリファレンス¶
メインモジュール。
-
class
potranslator.potranslator.
PoTranslator
(pot_dir=None, locale_dir=None)[ソース]¶ これはこのライブラリの主要クラスです。このクラスはすべての翻訳タスクを管理します。
パラメータ: - pot_dir -- 文字列。 potディレクトリへのパス。
- locale_dir -- 文字列。ロケールディレクトリへのパス。
-
translate
(file_name, target_lang='auto', src_lang='auto', encoding='utf-8', auto_save=False, compiled=False)[ソース]¶ 与えられたpoファイルを指定されたターゲット言語で翻訳します。
パラメータ: - file_name -- 文字列。変換するファイルのファイル名へのパス。
- target_lang -- 文字列。翻訳の対象言語。
- src_lang -- 文字列。翻訳元言語。
- encoding -- 文字列。 poファイルを保存するためのエンコーディング。
- auto_save -- ブール自動保存機能を切り替えます。
- compiled -- ブールコンパイルをmoファイルに切り替えます。
戻り値: タプル。元のカタログの翻訳バージョンとPOFileのステータスを含むタプル。
-
translate_all_locale
(src_lang='auto', encoding='utf-8', auto_save=False, compiled=False)[ソース]¶ 見つかった言語のすべてのpoファイルをロケールフォルダに翻訳します。
パラメータ: - src_lang -- 文字列。翻訳元言語。
- encoding -- 文字列。 poファイルを保存するためのエンコーディング。
- auto_save -- ブール自動保存機能を切り替えます。
- compiled -- ブールコンパイルをmoファイルに切り替えます。
戻り値: 辞書。 poファイルの辞書。
-
translate_from_pot
(filename, status, target_langs, src_lang='auto', encoding='utf-8', auto_save=False, compiled=False)[ソース]¶ 与えられたポットファイルを指定されたターゲット言語で翻訳します。
パラメータ: - filename -- 文字列。変換するファイルのファイル名へのパス。
- target_langs -- 文字列のシーケンス。翻訳の対象言語。
- src_lang -- 文字列。翻訳元言語。
- encoding -- 文字列。 poファイルを保存するためのエンコーディング。
- auto_save -- ブール自動保存機能を切り替えます。
- compiled -- ブールコンパイルをmoファイルに切り替えます。
戻り値: 辞書。 poファイルの辞書。
-
translate_all_pot
(target_langs, src_lang='auto', encoding='utf-8', auto_save=False, compiled=False)[ソース]¶ 指定したターゲット言語のpotフォルダ内のすべてのファイルを変換します。
パラメータ: - target_langs -- 文字列のシーケンス。翻訳の対象言語。
- src_lang -- 文字列。翻訳元言語。
- encoding -- 文字列。 poファイルを保存するためのエンコーディング。
- auto_save -- ブール自動保存機能を切り替えます。
- compiled -- ブールコンパイルをmoファイルに切り替えます。
戻り値: 辞書。 poファイルの辞書。
貢献する¶
寄付は大歓迎です、そして、彼らは大いに感謝しています!少しずつ助けられ、常に信用が与えられます。
あなたはいろいろな方法で貢献することができます:
貢献の種類¶
レポートのバグ¶
バグはhttps://github.com/SekouD/potranslator/issuesで報告してください。
バグを報告している場合は、以下を含めてください:
- お使いのオペレーティングシステムの名前とバージョン。
- トラブルシューティングに役立つローカルセットアップに関する詳細。
- バグを再現するための詳細な手順。
バグ修正¶
GitHubのバグの問題を見てください。 「バグ」と「ヘルプが必要」とタグ付けされたものは誰でも、それを実装したいと思っている人には公開されています。
機能を実装する¶
機能についてはGitHubの問題を見てください。 「強化」と「援助したい」というタグが付いているものは、誰でもそれを実装したいと思う人には公開されています。
ドキュメントを書く¶
翻訳者は、公式の翻訳者ドキュメント、ドキュメントストリング、ブログ記事、記事などのウェブ上であっても、常により多くのドキュメントを使用することができます。
フィードバックを送信¶
フィードバックを送信する最善の方法は、https://github.com/SekouD/potranslator/issuesで問題を提出することです。
フィーチャーを提案している場合:
- それがどのように機能するかを詳細に説明してください。
- スコープをできるだけ狭くしておくと、実装が簡単になります。
- これはボランティア主導のプロジェクトであり、貢献は歓迎します:)
始めよう!¶
貢献する準備ができましたか?ローカル開発のために `potranslator 'を設定する方法は次のとおりです。
GitHubで `potranslator`リポジトリをフォークします。
ローカルでフォークをクローン:
$ git clone git@github.com:your_name_here/potranslator.git
ローカルコピーをvirtualenvにインストールします。 virtualenvwrapperがインストールされていると仮定すると、ローカル開発用にフォークを設定する方法です:
$ mkvirtualenv potranslator $ cd potranslator/ $ python setup.py develop
ローカル開発のためのブランチを作成する:
$ git checkout -b name-of-your-bugfix-or-feature
これで、ローカルで変更を加えることができます。
変更が終わったら、変更内容がflake8とtestingを通過していることを確認します。他のPythonのバージョンをtoxでテストすることもできます:
$ flake8 potranslator tests $ python setup.py test or py.test $ tox
flake8とtoxを取得するには、それらをvirtualenvにインストールしてください。
変更をコミットしてブランチをGitHub ::に送ります
$ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature
GitHubのウェブサイトからプルリクエストを提出してください。
プルリクエストガイドライン¶
プルリクエストを送信する前に、次のガイドラインに従っていることを確認してください:
- プルリクエストにはテストを含める必要があります。
- プル要求が機能を追加する場合は、ドキュメントを更新する必要があります。新しい機能をドキュメントストリングを含む関数に置き、その機能をREADME.rstのリストに追加します。
- プルリクエストは、Python 2.7,3.4,3.5、および3.6、およびPyPyで動作するはずです。 https://travis-ci.org/SekouD/potranslator/pull_requestsをチェックし、テストがサポートされているすべてのPythonバージョンを通過することを確認してください。
展開¶
保守担当者にデプロイ方法のリマインダー。すべての変更がコミットされていることを確認してください(HISTORY.rstのエントリを含む)。次に実行:
$ bumpversion patch # possible: major / minor / patch
$ git push
$ git push --tags
テストが合格するとTravisはPyPIにデプロイします。
クレジット¶
開発リード¶
- SekouD <sekoud.python@gmail.com> GPG key ID: B51D1046EF63C50B
貢献者¶
まだありません。なぜ、最初にならないの?
歴史¶
1.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)¶
- 最初のリリース候補。
- コマンドラインインターフェイスが追加されました。
0.1.0(2018-06-27)¶
- PyPIの最初のリリース。
指数と表¶
- :ref: genindex
- :ref: modindex
- :ref: search