Weblate's REST API¶
バージョン 2.6 で追加: REST API は、Weblate 2.6 から使用できる。
API は /api/
URL からアクセスでき、Django REST framework がベースになっています。直接もしくは、Weblate クライアント から使用できます。
認証と一般的なパラメータ¶
公開プロジェクト API は認証なしで使用できますが、認証されていないリクエストは大幅に制限します(デフォルトでは、毎日100リクエスト)。制限回避のために、認証の使用を推奨します。認証ではトークンを使用し、ユーザー情報から取得します。Authorization
ヘッダーで使用する項目:
-
ANY
/
¶ API、ヘッダー、ステータスコード、およびパラメータの一般的なリクエスト動作は、すべてのエンドポイントにも適用します。
- クエリ パラメータ
format -- レスポンス形式(上書き Accept)。指定できる値は REST フレームワークの設定に依存します。デフォルトでは
json
およびapi
に対応。後者には、API 用の Web ブラウザー インターフェースを提供する。
- リクエスト ヘッダー
Authorization -- 認証用のオプションのトークン
- レスポンス ヘッダー
Content-Type -- リクエストの Accept ヘッダーに依存する
Allow -- オブジェクトで許可されている HTTP メソッドのリスト
- レスポンス JSON オブジェクト
detail (string) -- 結果の詳細な説明(200 OK 以外の HTTP ステータス コードの場合)
count (int) -- オブジェクト リストの合計項目数
next (string) -- オブジェクト リストの次のページの URL
previous (string) -- オブジェクト リストの前のページの URL
results (array) -- オブジェクト リストの結果
url (string) -- このリソースへの API を使用したアクセス用の URL
web_url (string) -- このリソースへの Web ブラウザを使用したアクセス用の URL
- ステータスコード
200 OK -- リクエストが正常に処理された場合
201 Created -- when a new object was created successfully
204 No Content -- when an object was created successfully
400 Bad Request -- フォーム パラメータが不足している場合
403 Forbidden -- アクセスが拒否された場合
429 Too Many Requests -- スロットルが設定されている場合
認証の例¶
リクエストの例:
GET /api/ HTTP/1.1
Host: example.com
Accept: application/json, text/javascript
Authorization: Token YOUR-TOKEN
レスポンスの例:
HTTP/1.0 200 OK
Date: Fri, 25 Mar 2016 09:46:12 GMT
Server: WSGIServer/0.1 Python/2.7.11+
Vary: Accept, Accept-Language, Cookie
X-Frame-Options: SAMEORIGIN
Content-Type: application/json
Content-Language: en
Allow: GET, HEAD, OPTIONS
{
"projects":"http://example.com/api/projects/",
"components":"http://example.com/api/components/",
"translations":"http://example.com/api/translations/",
"languages":"http://example.com/api/languages/"
}
CURL の例:
curl \
-H "Authorization: Token TOKEN" \
https://example.com/api/
パラメータの受け渡し例¶
POST メソッドでは、フォーム送信(application/x-www-form-urlencoded)または JSON(application/json)のどちらかでパラメータを指定します。
フォーム リクエストの例:
POST /api/projects/hello/repository/ HTTP/1.1
Host: example.com
Accept: application/json
Content-Type: application/x-www-form-urlencoded
Authorization: Token TOKEN
operation=pull
JSON リクエストの例:
POST /api/projects/hello/repository/ HTTP/1.1
Host: example.com
Accept: application/json
Content-Type: application/json
Authorization: Token TOKEN
Content-Length: 20
{"operation":"pull"}
CURL の例:
curl \
-d operation=pull \
-H "Authorization: Token TOKEN" \
http://example.com/api/components/hello/weblate/repository/
CURL JSON の例:
curl \
--data-binary '{"operation":"pull"}' \
-H "Content-Type: application/json" \
-H "Authorization: Token TOKEN" \
http://example.com/api/components/hello/weblate/repository/
API 接続制限¶
API リクエストは接続制限しています。デフォルト設定では、匿名ユーザーの場合は 100 リクエスト / 日、認証済みユーザーの場合は 5000 リクエスト / 時間に制限しています。
接続制限は settings.py
で変更できます。詳細な設定方法は、Throttling in Django REST framework documentation を確認してください。
ヘッダーで報告される接続制限の状態:
|
実行するリクエストの接続制限回数 |
|
リクエストが制限されるまでの回数 |
|
接続可能秒数がリセットされるまでの秒数 |
バージョン 4.1 で変更: 接続制限状態のヘッダーの追加。
API エントリ ポイント¶
-
GET
/api/
¶ API ルート エントリ ポイント。
リクエストの例:
GET /api/ HTTP/1.1 Host: example.com Accept: application/json, text/javascript Authorization: Token YOUR-TOKEN
レスポンスの例:
HTTP/1.0 200 OK Date: Fri, 25 Mar 2016 09:46:12 GMT Server: WSGIServer/0.1 Python/2.7.11+ Vary: Accept, Accept-Language, Cookie X-Frame-Options: SAMEORIGIN Content-Type: application/json Content-Language: en Allow: GET, HEAD, OPTIONS { "projects":"http://example.com/api/projects/", "components":"http://example.com/api/components/", "translations":"http://example.com/api/translations/", "languages":"http://example.com/api/languages/" }
ユーザー¶
バージョン 4.0 で追加.
-
GET
/api/users/
¶ 返り値は、ユーザーの管理権限を持っている場合は、ユーザーの一覧です。持っていない場合は、自分の詳細のみになります。
参考
ユーザー オブジェクトの属性については、
GET /api/users/(str:username)/
にドキュメントがあります。
-
POST
/api/users/
¶ 新しいユーザーを作成します。
- パラメータ
username (string) -- ユーザー名
full_name (string) -- ユーザーのフルネーム
email (string) -- ユーザーのメールアドレス
is_superuser (boolean) -- ユーザーがスーパーユーザーかどうか? (オプション)
is_active (boolean) -- ユーザーが有効かどうか? (オプション)
-
GET
/api/users/
(str: username)/
¶ 返り値は、ユーザーの情報です。
- パラメータ
username (string) -- ユーザーのユーザー名
- レスポンス JSON オブジェクト
username (string) -- ユーザーのユーザー名
full_name (string) -- ユーザーのフルネーム
email (string) -- ユーザーのメールアドレス
is_superuser (boolean) -- ユーザーがスーパーユーザーかどうか
is_active (boolean) -- ユーザーが有効かどうか
date_joined (string) -- ユーザー登録日
groups (array) -- 関連するグループへのリンク。参照:
GET /api/groups/(int:id)/
JSON データの例:
{ "email": "user@example.com", "full_name": "Example User", "username": "exampleusername", "groups": [ "http://example.com/api/groups/2/", "http://example.com/api/groups/3/" ], "is_superuser": true, "is_active": true, "date_joined": "2020-03-29T18:42:42.617681Z", "url": "http://example.com/api/users/exampleusername/", "statistics_url": "http://example.com/api/users/exampleusername/statistics/" }
-
PUT
/api/users/
(str: username)/
¶ ユーザーのパラメータを変更します。
- パラメータ
username (string) -- ユーザーのユーザー名
- レスポンス JSON オブジェクト
username (string) -- ユーザーのユーザー名
full_name (string) -- ユーザーのフルネーム
email (string) -- ユーザーのメールアドレス
is_superuser (boolean) -- ユーザーがスーパーユーザーかどうか
is_active (boolean) -- ユーザーが有効かどうか
date_joined (string) -- ユーザー登録日
-
PATCH
/api/users/
(str: username)/
¶ ユーザーのパラメータを変更します。
- パラメータ
username (string) -- ユーザーのユーザー名
- レスポンス JSON オブジェクト
username (string) -- ユーザーのユーザー名
full_name (string) -- ユーザーのフルネーム
email (string) -- ユーザーのメールアドレス
is_superuser (boolean) -- ユーザーがスーパーユーザーかどうか
is_active (boolean) -- ユーザーが有効かどうか
date_joined (string) -- ユーザー登録日
-
DELETE
/api/users/
(str: username)/
¶ ユーザーのすべての情報を削除し、ユーザーを無効にします。
- パラメータ
username (string) -- ユーザーのユーザー名
-
POST
/api/users/
(str: username)/groups/
¶ ユーザーをグループに設定します。
- パラメータ
username (string) -- ユーザーのユーザー名
- フォーム パラメーター
string group_id -- 固有のグループ ID
-
GET
/api/users/
(str: username)/statistics/
¶ ユーザーの統計情報を一覧表示します。
- パラメータ
username (string) -- ユーザーのユーザー名
- レスポンス JSON オブジェクト
translated (int) -- ユーザーごとの翻訳数
suggested (int) -- ユーザーごとの提案数
uploaded (int) -- ユーザーごとのアップロード数
commented (int) -- ユーザーごとのコメント数
languages (int) -- ユーザーごとの翻訳可能な言語数
-
GET
/api/users/
(str: username)/notifications/
¶ ユーザーのサブスクリプションを一覧表示します。
- パラメータ
username (string) -- ユーザーのユーザー名
-
POST
/api/users/
(str: username)/notifications/
¶ ユーザーにサブスクリプションを関連付けます。
- パラメータ
username (string) -- ユーザーのユーザー名
- リクエスト JSON オブジェクト
notification (string) -- 登録中の通知の名前
scope (int) -- 選択肢の中で有効な通知する範囲
frequency (int) -- 通知の頻度の選択
-
GET
/api/users/
(str: username)/notifications/
(int: subscription_id)/
¶ ユーザーに設定中のサブスクリプションを取得します。
- パラメータ
username (string) -- ユーザーのユーザー名
subscription_id (int) -- 登録中の通知 ID
-
PUT
/api/users/
(str: username)/notifications/
(int: subscription_id)/
¶ ユーザーに設定されたサブスクリプションを編集します。
- パラメータ
username (string) -- ユーザーのユーザー名
subscription_id (int) -- 登録中の通知 ID
- リクエスト JSON オブジェクト
notification (string) -- 登録中の通知の名前
scope (int) -- 選択肢の中で有効な通知する範囲
frequency (int) -- 通知の頻度の選択
-
PATCH
/api/users/
(str: username)/notifications/
(int: subscription_id)/
¶ ユーザーに設定されたサブスクリプションを編集します。
- パラメータ
username (string) -- ユーザーのユーザー名
subscription_id (int) -- 登録中の通知 ID
- リクエスト JSON オブジェクト
notification (string) -- 登録中の通知の名前
scope (int) -- 選択肢の中で有効な通知する範囲
frequency (int) -- 通知の頻度の選択
-
DELETE
/api/users/
(str: username)/notifications/
(int: subscription_id)/
¶ ユーザーに設定されたサブスクリプションを削除します。
- パラメータ
username (string) -- ユーザーのユーザー名
subscription_id -- 登録中の通知の名前
subscription_id -- int
グループ¶
バージョン 4.0 で追加.
-
GET
/api/groups/
¶ 返り値は、グループの管理権限がある場合は、グループの一覧です。権限がない場合は、指定したユーザーが所属しているグループのみになります。
参考
グループ オブジェクトの属性については、
GET /api/groups/(int:id)/
にドキュメントがあります。
-
POST
/api/groups/
¶ 新しいグループを作成します。
- パラメータ
name (string) -- グループ名
project_selection (int) -- 指定した選択肢から選択したプロジェクトのグループ
language_selection (int) -- 指定した選択肢から選択した言語のグループ
-
GET
/api/groups/
(int: id)/
¶ 返り値は、グループの情報です。
- パラメータ
id (int) -- グループ ID
- レスポンス JSON オブジェクト
name (string) -- グループ名
project_selection (int) -- 整数 プロジェクトのグループ番号
language_selection (int) -- 整数 言語のグループ番号
roles (array) -- 関連するロールへのリンク。参照:
GET /api/roles/(int:id)/
projects (array) -- 関連するプロジェクトへのリンク。参照:
GET /api/projects/(string:project)/
components (array) -- 関連するコンポーネントへのリンク。参照:
GET /api/components/(string:project)/(string:component)/
componentlist (array) -- 関連するコンポーネント リストへのリンク。参照:
GET /api/component-lists/(str:slug)/
JSON データの例:
{ "name": "Guests", "project_selection": 3, "language_selection": 1, "url": "http://example.com/api/groups/1/", "roles": [ "http://example.com/api/roles/1/", "http://example.com/api/roles/2/" ], "languages": [ "http://example.com/api/languages/en/", "http://example.com/api/languages/cs/", ], "projects": [ "http://example.com/api/projects/demo1/", "http://example.com/api/projects/demo/" ], "componentlist": "http://example.com/api/component-lists/new/", "components": [ "http://example.com/api/components/demo/weblate/" ] }
-
PUT
/api/groups/
(int: id)/
¶ グループ パラメータを変更します。
- パラメータ
id (int) -- グループ ID
- レスポンス JSON オブジェクト
name (string) -- グループ名
project_selection (int) -- 整数 プロジェクトのグループ番号
language_selection (int) -- 整数 言語のグループ番号
-
PATCH
/api/groups/
(int: id)/
¶ グループ パラメータを変更します。
- パラメータ
id (int) -- グループ ID
- レスポンス JSON オブジェクト
name (string) -- グループ名
project_selection (int) -- 整数 プロジェクトのグループ番号
language_selection (int) -- 整数 言語のグループ番号
-
DELETE
/api/groups/
(int: id)/
¶ グループを削除します。
- パラメータ
id (int) -- グループ ID
-
POST
/api/groups/
(int: id)/roles/
¶ グループにロールを関連付けます。
- パラメータ
id (int) -- グループ ID
- フォーム パラメーター
string role_id -- 固有のロール ID
-
POST
/api/groups/
(int: id)/components/
¶ グループにコンポーネントを関連付けます。
- パラメータ
id (int) -- グループ ID
- フォーム パラメーター
string component_id -- 固有のコンポーネント ID
-
DELETE
/api/groups/
(int: id)/components/
(int: component_id)¶ グループからコンポーネントを削除します。
- パラメータ
id (int) -- グループ ID
component_id (int) -- 固有のコンポーネント ID
-
POST
/api/groups/
(int: id)/projects/
¶ グループにプロジェクトを関連付けます。
- パラメータ
id (int) -- グループ ID
- フォーム パラメーター
string project_id -- 固有のプロジェクト ID
-
DELETE
/api/groups/
(int: id)/projects/
(int: project_id)¶ プロジェクトをグループから削除します。
- パラメータ
id (int) -- グループ ID
project_id (int) -- 固有のプロジェクト ID
-
POST
/api/groups/
(int: id)/languages/
¶ グループに言語を関連付けます。
- パラメータ
id (int) -- グループ ID
- フォーム パラメーター
string language_code -- 固有の言語コード
-
DELETE
/api/groups/
(int: id)/languages/
(string: language_code)¶ 言語をグループから削除します。
- パラメータ
id (int) -- グループ ID
language_code (string) -- 固有の言語コード
-
POST
/api/groups/
(int: id)/componentlists/
¶ コンポーネント リストをグループに関連付けます。
- パラメータ
id (int) -- グループ ID
- フォーム パラメーター
string component_list_id -- 固有のコンポーネントリスト ID
-
DELETE
/api/groups/
(int: id)/componentlists/
(int: component_list_id)¶ コンポーネントリストをグループから削除します。
- パラメータ
id (int) -- グループ ID
component_list_id (int) -- 固有のコンポーネントリスト ID
ロール¶
-
GET
/api/roles/
¶ 返り値は、ユーザーに関連付けられたすべてのロールのリストです。ユーザーがスーパーユーザーの場合は、既存のすべてのロールのリストになります。
参考
ロールオブジェクトの属性については、
GET /api/roles/(int:id)/
にドキュメントがあります。
-
POST
/api/roles/
¶ 新しいロールを作成します。
- パラメータ
name (string) -- ロール名
permissions (array) -- アクセス権のコードネーム リスト
-
GET
/api/roles/
(int: id)/
¶ 返り値は、ロールの情報です。
- パラメータ
id (int) -- ロール ID
- レスポンス JSON オブジェクト
name (string) -- ロール名
permissions (array) -- アクセス権のコードネーム リスト
JSON データの例:
{ "name": "Access repository", "permissions": [ "vcs.access", "vcs.view" ], "url": "http://example.com/api/roles/1/", }
-
PUT
/api/roles/
(int: id)/
¶ ロールのパラメータを変更します。
- パラメータ
id (int) -- ロール ID
- レスポンス JSON オブジェクト
name (string) -- ロール名
permissions (array) -- アクセス権のコードネーム リスト
-
PATCH
/api/roles/
(int: id)/
¶ ロールのパラメータを変更します。
- パラメータ
id (int) -- ロール ID
- レスポンス JSON オブジェクト
name (string) -- ロール名
permissions (array) -- アクセス権のコードネーム リスト
-
DELETE
/api/roles/
(int: id)/
¶ ロールを削除します。
- パラメータ
id (int) -- ロール ID
言語¶
-
GET
/api/languages/
¶ 返り値は、すべての言語のリストです。
参考
言語オブジェクトの属性については、
GET /api/languages/(string:language)/
にドキュメントがあります。
-
POST
/api/languages/
¶ 新しい言語を作成します。
- パラメータ
code (string) -- 言語名
name (string) -- 言語名
direction (string) -- テキストの方向
plural (object) -- 言語の複数形と数
-
GET
/api/languages/
(string: language)/
¶ 返り値は、言語の情報です。
- パラメータ
language (string) -- 言語コード
- レスポンス JSON オブジェクト
code (string) -- 言語コード
direction (string) -- テキストの方向
plural (object) -- 言語の複数形の情報についてのオブジェクト
aliases (array) -- 言語のエイリアスの配列
JSON データの例:
{ "code": "en", "direction": "ltr", "name": "English", "plural": { "id": 75, "source": 0, "number": 2, "formula": "n != 1", "type": 1 }, "aliases": [ "english", "en_en", "base", "source", "eng" ], "url": "http://example.com/api/languages/en/", "web_url": "http://example.com/languages/en/", "statistics_url": "http://example.com/api/languages/en/statistics/" }
-
PUT
/api/languages/
(string: language)/
¶ 言語パラメータを変更します。
- パラメータ
language (string) -- 言語コード
- リクエスト JSON オブジェクト
name (string) -- 言語名
direction (string) -- テキストの方向
plural (object) -- 言語の複数形の詳細
-
PATCH
/api/languages/
(string: language)/
¶ 言語パラメータを変更します。
- パラメータ
language (string) -- 言語コード
- リクエスト JSON オブジェクト
name (string) -- 言語名
direction (string) -- テキストの方向
plural (object) -- 言語の複数形の詳細
-
DELETE
/api/languages/
(string: language)/
¶ 言語を削除します。
- パラメータ
language (string) -- 言語コード
-
GET
/api/languages/
(string: language)/statistics/
¶ 返り値は、言語の統計情報です。
- パラメータ
language (string) -- 言語コード
- レスポンス JSON オブジェクト
total (int) -- 文字列の総数
total_words (int) -- 単語の総数
last_change (timestamp) -- 言語での最後の変更
recent_changes (int) -- 変更の総数
translated (int) -- 翻訳済み文字列の数
translated_percent (float) -- 翻訳済みの文字列の割合
translated_words (int) -- 翻訳済みの単語の数
translated_words_percent (int) -- 翻訳済みの単語の割合
translated_chars (int) -- 翻訳済みの文字数
translated_chars_percent (int) -- 翻訳済みの文字の割合
total_chars (int) -- 合計文字数
fuzzy (int) -- あいまいな(要編集付き)文字列の数
fuzzy_percent (int) -- あいまいな(要編集付き)文字列の割合
failing (int) -- 検査不合格の文字列数
failing -- 検査不合格のもの割合
プロジェクト¶
-
GET
/api/projects/
¶ 返り値は、すべてのプロジェクトのリストです。
参考
プロジェクトオブジェクトの属性については、
GET /api/projects/(string:project)/
にドキュメントがあります。
-
POST
/api/projects/
¶ バージョン 3.9 で追加.
新しいプロジェクトを作成します。
- パラメータ
name (string) -- プロジェクト名
slug (string) -- プロジェクトのスラッグ
web (string) -- プロジェクトの Web サイト
-
GET
/api/projects/
(string: project)/
¶ 返り値は、プロジェクトの情報です。
- パラメータ
project (string) -- プロジェクト URL スラッグ
- レスポンス JSON オブジェクト
name (string) -- プロジェクト名
slug (string) -- プロジェクトのスラッグ
web (string) -- プロジェクトの Web サイト
components_list_url (string) -- コンポーネントリスト への URL。参照:
GET /api/projects/(string:project)/components/
repository_url (string) -- リポジトリステータスへのURL。参照:
GET /api/projects/(string:project)/repository/
changes_list_url (string) -- 変更リストへの URL。参照:
GET /api/projects/(string:project)/changes/
translation_review (boolean) -- 査読の有効化
source_review (boolean) -- 原文の査読の有効化
set_language_team (boolean) -- "Language-Team" ヘッダの設定
enable_hooks (boolean) -- フックの有効化
instructions (string) -- 翻訳についての説明
language_aliases (string) -- 言語の別名
JSON データの例:
{ "name": "Hello", "slug": "hello", "url": "http://example.com/api/projects/hello/", "web": "https://weblate.org/", "web_url": "http://example.com/projects/hello/" }
-
PATCH
/api/projects/
(string: project)/
¶ バージョン 4.3 で追加.
PATCH リクエストでプロジェクトを編集します。
- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
-
PUT
/api/projects/
(string: project)/
¶ バージョン 4.3 で追加.
PUT リクエストでプロジェクトを編集します。
- パラメータ
project (string) -- プロジェクト URL スラッグ
-
DELETE
/api/projects/
(string: project)/
¶ バージョン 3.9 で追加.
プロジェクトを削除します。
- パラメータ
project (string) -- プロジェクト URL スラッグ
-
GET
/api/projects/
(string: project)/changes/
¶ 帰り値は、変更があったプロジェクトのリストです。これは基本的には、同じパラメータを受け入れる
GET /api/changes/
にスコープしたプロジェクトです。- パラメータ
project (string) -- プロジェクト URL スラッグ
- レスポンス JSON オブジェクト
results (array) -- コンポーネントオブジェクトの配列。参照:
GET /api/changes/(int:id)/
-
GET
/api/projects/
(string: project)/repository/
¶ 返り値は、VCS リポジトリのステータスに関する情報です。このエンドポイントには、プロジェクトのすべてのリポジトリの全体的な概要のみが含まれています。より詳細なステータスを取得するには
GET /api/components/(string:project)/(string:component)/repository/
を使用してください。- パラメータ
project (string) -- プロジェクト URL スラッグ
- レスポンス JSON オブジェクト
needs_commit (boolean) -- コミットが必要な保留中の変更があるかどうか
needs_merge (boolean) -- マージが必要な upstream に変更があるかどうか
needs_push (boolean) -- プッシュが必要なローカルに変更があるかどうか
JSON データの例:
{ "needs_commit": true, "needs_merge": false, "needs_push": true }
-
POST
/api/projects/
(string: project)/repository/
¶ VCS リポジトリで指定の操作を実行します。
- パラメータ
project (string) -- プロジェクト URL スラッグ
- リクエスト JSON オブジェクト
operation (string) -- 実行する操作:
push
,pull
,commit
,reset
,cleanup
,file-sync
のいずれか一つ
- レスポンス JSON オブジェクト
result (boolean) -- 操作の結果
CURL の例:
curl \ -d operation=pull \ -H "Authorization: Token TOKEN" \ http://example.com/api/projects/hello/repository/
JSON リクエストの例:
POST /api/projects/hello/repository/ HTTP/1.1 Host: example.com Accept: application/json Content-Type: application/json Authorization: Token TOKEN Content-Length: 20 {"operation":"pull"}
JSON レスポンスの例:
HTTP/1.0 200 OK Date: Tue, 12 Apr 2016 09:32:50 GMT Server: WSGIServer/0.1 Python/2.7.11+ Vary: Accept, Accept-Language, Cookie X-Frame-Options: SAMEORIGIN Content-Type: application/json Content-Language: en Allow: GET, POST, HEAD, OPTIONS {"result":true}
-
GET
/api/projects/
(string: project)/components/
¶ 返り値は、指定したプロジェクト内の翻訳コンポーネントのリストです。
- パラメータ
project (string) -- プロジェクト URL スラッグ
- レスポンス JSON オブジェクト
results (array) -- コンポーネント オブジェクトの配列。参照:
GET /api/components/(string:project)/(string:component)/
-
POST
/api/projects/
(string: project)/components/
¶ バージョン 3.9 で追加.
バージョン 4.3 で変更:
zipfile
およびdocfile
パラメータは、VCS なしのコンポーネントでも使用できるようになりました。参照: ローカル ファイル。バージョン 4.6 で変更: The cloned repositories are now automatically shared within a project using Weblate の内部 URL. Use
disable_autoshare
to turn off this.指定したプロジェクトに翻訳コンポーネントを作成します。
ヒント
1 つの VCS リポジトリから複数のコンポーネントを作成するには、Weblate の内部 URL を使用します。
注釈
ほとんどのコンポーネントの作成は、バックグラウンドで実行されます。作成したコンポーネントの
task_url
属性を確認し、その進捗状況を確認します。- パラメータ
project (string) -- プロジェクト URL スラッグ
- フォーム パラメーター
file zipfile -- 翻訳の初期化のために Weblate にアップロードする ZIP ファイル
file docfile -- 翻訳するドキュメント
boolean disable_autoshare -- Disables automatic repository sharing via Weblate の内部 URL.
- レスポンス JSON オブジェクト
result (object) -- 作成されたコンポーネント オブジェクト。参照:
GET /api/components/(string:project)/(string:component)/
JSON can not be used when uploading the files using the
zipfile
anddocfile
parameters. The data has to be uploaded as multipart/form-data.CURL フォーム リクエスト例:
curl \ --form docfile=@strings.html \ --form name=Weblate \ --form slug=weblate \ --form file_format=html \ --form new_lang=add \ -H "Authorization: Token TOKEN" \ http://example.com/api/projects/hello/components/
CURL JSON リクエスト例:
curl \ --data-binary '{ "branch": "main", "file_format": "po", "filemask": "po/*.po", "git_export": "", "license": "", "license_url": "", "name": "Weblate", "slug": "weblate", "repo": "file:///home/nijel/work/weblate-hello", "template": "", "new_base": "", "vcs": "git" }' \ -H "Content-Type: application/json" \ -H "Authorization: Token TOKEN" \ http://example.com/api/projects/hello/components/
JSON リクエストの例:
POST /api/projects/hello/components/ HTTP/1.1 Host: example.com Accept: application/json Content-Type: application/json Authorization: Token TOKEN Content-Length: 20 { "branch": "main", "file_format": "po", "filemask": "po/*.po", "git_export": "", "license": "", "license_url": "", "name": "Weblate", "slug": "weblate", "repo": "file:///home/nijel/work/weblate-hello", "template": "", "new_base": "", "vcs": "git" }
JSON レスポンスの例:
HTTP/1.0 200 OK Date: Tue, 12 Apr 2016 09:32:50 GMT Server: WSGIServer/0.1 Python/2.7.11+ Vary: Accept, Accept-Language, Cookie X-Frame-Options: SAMEORIGIN Content-Type: application/json Content-Language: en Allow: GET, POST, HEAD, OPTIONS { "branch": "main", "file_format": "po", "filemask": "po/*.po", "git_export": "", "license": "", "license_url": "", "name": "Weblate", "slug": "weblate", "project": { "name": "Hello", "slug": "hello", "source_language": { "code": "en", "direction": "ltr", "name": "English", "url": "http://example.com/api/languages/en/", "web_url": "http://example.com/languages/en/" }, "url": "http://example.com/api/projects/hello/", "web": "https://weblate.org/", "web_url": "http://example.com/projects/hello/" }, "repo": "file:///home/nijel/work/weblate-hello", "template": "", "new_base": "", "url": "http://example.com/api/components/hello/weblate/", "vcs": "git", "web_url": "http://example.com/projects/hello/weblate/" }
-
GET
/api/projects/
(string: project)/languages/
¶ 返り値は、プロジェクト内の全言語のページ順の統計情報です。
バージョン 3.8 で追加.
- パラメータ
project (string) -- プロジェクト URL スラッグ
- レスポンス JSON オブジェクト
results (array) -- 翻訳統計オブジェクトの配列
language (string) -- 言語名
code (string) -- 言語コード
total (int) -- 文字列の総数
translated (int) -- 翻訳済み文字列の数
translated_percent (float) -- 翻訳済みの文字列の割合
total_words (int) -- 単語の総数
translated_words (int) -- 翻訳済みの単語の数
words_percent (float) -- 翻訳済みの単語の割合
-
GET
/api/projects/
(string: project)/statistics/
¶ 返り値は、プロジェクトの統計情報です。
バージョン 3.8 で追加.
- パラメータ
project (string) -- プロジェクト URL スラッグ
- レスポンス JSON オブジェクト
total (int) -- 文字列の総数
translated (int) -- 翻訳済み文字列の数
translated_percent (float) -- 翻訳済みの文字列の割合
total_words (int) -- 単語の総数
translated_words (int) -- 翻訳済みの単語の数
words_percent (float) -- 翻訳済みの単語の割合
コンポーネント¶
-
GET
/api/components/
¶ 返り値は、翻訳コンポーネントのリストです。
参考
コンポーネント オブジェクトの属性については、
GET /api/components/(string:project)/(string:component)/
にドキュメントがあります。
-
GET
/api/components/
(string: project)/
(string: component)/
¶ 返り値は、翻訳コンポーネントに関する情報です。
- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
- レスポンス JSON オブジェクト
project (object) -- 翻訳プロジェクト。参照:
GET /api/projects/(string:project)/
name (string) -- コンポーネント名
slug (string) -- コンポーネントのスラッグ
vcs (string) -- バージョン管理システム
repo (string) -- ソースコードのリポジトリ
git_export (string) -- エクスポートされたリポジトリ URL
branch (string) -- リポジトリブランチ
push_branch (string) -- ブランチに push
filemask (string) -- File mask
template (string) -- 単一言語のベース言語ファイル
edit_template (string) -- 基本ファイルの編集
intermediate (string) -- 中間言語ファイル
new_base (string) -- 新しい翻訳のテンプレート
file_format (string) -- ファイル形式
license (string) -- 翻訳のライセンス
agreement (string) -- 貢献者同意条項
new_lang (string) -- 新しい翻訳の追加
language_code_style (string) -- 言語コード スタイル
source_language (object) -- 原文の言語のオブジェクト。参照:
GET /api/languages/(string:language)/
push (string) -- リポジトリの送信先 URL
check_flags (string) -- 翻訳フラグ
priority (string) -- 優先順位
enforced_checks (string) -- 検査の強制
restricted (string) -- アクセス制限
repoweb (string) -- リポジトリ ブラウザー
report_source_bugs (string) -- 原文ミスの報告先アドレス
merge_style (string) -- マージ スタイル
commit_message (string) -- Commit, add, delete, merge and addon messages
add_message (string) -- Commit, add, delete, merge and addon messages
delete_message (string) -- Commit, add, delete, merge and addon messages
merge_message (string) -- Commit, add, delete, merge and addon messages
addon_message (string) -- Commit, add, delete, merge and addon messages
allow_translation_propagation (string) -- 翻訳の自動反映の有効化
enable_suggestions (string) -- 提案の有効化
suggestion_voting (string) -- 提案への投票
suggestion_autoaccept (string) -- 提案の自動採用
push_on_commit (string) -- コミット時にプッシュする
commit_pending_age (string) -- コミットするまでの経過時間
auto_lock_error (string) -- エラー時にロック
language_regex (string) -- 言語フィルター
variant_regex (string) -- 異なる表記を特定する正規表現
repository_url (string) -- リポジトリ ステータスへの URL。参照:
GET /api/components/(string:project)/(string:component)/repository/
translations_url (string) -- 翻訳リストへの URL。参照:
GET /api/components/(string:project)/(string:component)/translations/
lock_url (string) -- ステータスをロックする URL。参照:
GET /api/components/(string:project)/(string:component)/lock/
changes_list_url (string) -- 変更リストへの URL。参照:
GET /api/components/(string:project)/(string:component)/changes/
task_url (string) -- バックグラウンド タスクへの URL(存在する場合)。参照:
GET /api/tasks/(str:uuid)/
JSON データの例:
{ "branch": "main", "file_format": "po", "filemask": "po/*.po", "git_export": "", "license": "", "license_url": "", "name": "Weblate", "slug": "weblate", "project": { "name": "Hello", "slug": "hello", "source_language": { "code": "en", "direction": "ltr", "name": "English", "url": "http://example.com/api/languages/en/", "web_url": "http://example.com/languages/en/" }, "url": "http://example.com/api/projects/hello/", "web": "https://weblate.org/", "web_url": "http://example.com/projects/hello/" }, "source_language": { "code": "en", "direction": "ltr", "name": "English", "url": "http://example.com/api/languages/en/", "web_url": "http://example.com/languages/en/" }, "repo": "file:///home/nijel/work/weblate-hello", "template": "", "new_base": "", "url": "http://example.com/api/components/hello/weblate/", "vcs": "git", "web_url": "http://example.com/projects/hello/weblate/" }
-
PATCH
/api/components/
(string: project)/
(string: component)/
¶ PATCH リクエストでコンポーネントを編集します。
- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
source_language (string) -- プロジェクトの原文の言語コード(オプション)
- リクエスト JSON オブジェクト
name (string) -- コンポーネント名
slug (string) -- コンポーネントのスラッグ
repo (string) -- VCS リポジトリ URL
CURL の例:
curl \ --data-binary '{"name": "new name"}' \ -H "Content-Type: application/json" \ -H "Authorization: Token TOKEN" \ PATCH http://example.com/api/projects/hello/components/
JSON リクエストの例:
PATCH /api/projects/hello/components/ HTTP/1.1 Host: example.com Accept: application/json Content-Type: application/json Authorization: Token TOKEN Content-Length: 20 { "name": "new name" }
JSON レスポンスの例:
HTTP/1.0 200 OK Date: Tue, 12 Apr 2016 09:32:50 GMT Server: WSGIServer/0.1 Python/2.7.11+ Vary: Accept, Accept-Language, Cookie X-Frame-Options: SAMEORIGIN Content-Type: application/json Content-Language: en Allow: GET, POST, HEAD, OPTIONS { "branch": "main", "file_format": "po", "filemask": "po/*.po", "git_export": "", "license": "", "license_url": "", "name": "new name", "slug": "weblate", "project": { "name": "Hello", "slug": "hello", "source_language": { "code": "en", "direction": "ltr", "name": "English", "url": "http://example.com/api/languages/en/", "web_url": "http://example.com/languages/en/" }, "url": "http://example.com/api/projects/hello/", "web": "https://weblate.org/", "web_url": "http://example.com/projects/hello/" }, "repo": "file:///home/nijel/work/weblate-hello", "template": "", "new_base": "", "url": "http://example.com/api/components/hello/weblate/", "vcs": "git", "web_url": "http://example.com/projects/hello/weblate/" }
-
PUT
/api/components/
(string: project)/
(string: component)/
¶ PUT リクエストでコンポーネントを編集します。
- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
- リクエスト JSON オブジェクト
branch (string) -- VCS リポジトリ ブランチ
file_format (string) -- 翻訳のファイル形式
filemask (string) -- リポジトリ内の翻訳ファイルのマスク
name (string) -- コンポーネント名
slug (string) -- コンポーネントのスラッグ
repo (string) -- VCS リポジトリ URL
template (string) -- base file for monolingual translations
new_base (string) -- base file for adding new translations
vcs (string) -- version control system
-
DELETE
/api/components/
(string: project)/
(string: component)/
¶ バージョン 3.9 で追加.
Deletes a component.
- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
-
GET
/api/components/
(string: project)/
(string: component)/changes/
¶ Returns a list of component changes. This is essentially a component scoped
GET /api/changes/
accepting same params.- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
- レスポンス JSON オブジェクト
results (array) -- コンポーネントオブジェクトの配列。参照:
GET /api/changes/(int:id)/
-
GET
/api/components/
(string: project)/
(string: component)/screenshots/
¶ Returns a list of component screenshots.
- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
- レスポンス JSON オブジェクト
results (array) -- array of component screenshots; see
GET /api/screenshots/(int:id)/
-
GET
/api/components/
(string: project)/
(string: component)/lock/
¶ Returns component lock status.
- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
- レスポンス JSON オブジェクト
locked (boolean) -- whether component is locked for updates
JSON データの例:
{ "locked": false }
-
POST
/api/components/
(string: project)/
(string: component)/lock/
¶ Sets component lock status.
Response is same as
GET /api/components/(string:project)/(string:component)/lock/
.- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
- リクエスト JSON オブジェクト
lock -- Boolean whether to lock or not.
CURL の例:
curl \ -d lock=true \ -H "Authorization: Token TOKEN" \ http://example.com/api/components/hello/weblate/repository/
JSON リクエストの例:
POST /api/components/hello/weblate/repository/ HTTP/1.1 Host: example.com Accept: application/json Content-Type: application/json Authorization: Token TOKEN Content-Length: 20 {"lock": true}
JSON レスポンスの例:
HTTP/1.0 200 OK Date: Tue, 12 Apr 2016 09:32:50 GMT Server: WSGIServer/0.1 Python/2.7.11+ Vary: Accept, Accept-Language, Cookie X-Frame-Options: SAMEORIGIN Content-Type: application/json Content-Language: en Allow: GET, POST, HEAD, OPTIONS {"locked":true}
-
GET
/api/components/
(string: project)/
(string: component)/repository/
¶ Returns information about VCS repository status.
The response is same as for
GET /api/projects/(string:project)/repository/
.- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
- レスポンス JSON オブジェクト
needs_commit (boolean) -- コミットが必要な保留中の変更があるかどうか
needs_merge (boolean) -- マージが必要な upstream に変更があるかどうか
needs_push (boolean) -- プッシュが必要なローカルに変更があるかどうか
remote_commit (string) -- Remote commit information
status (string) -- VCS repository status as reported by VCS
merge_failure -- Text describing merge failure or null if there is none
-
POST
/api/components/
(string: project)/
(string: component)/repository/
¶ Performs the given operation on a VCS repository.
See
POST /api/projects/(string:project)/repository/
for documentation.- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
- リクエスト JSON オブジェクト
operation (string) -- 実行する操作:
push
,pull
,commit
,reset
,cleanup
のいずれか一つ
- レスポンス JSON オブジェクト
result (boolean) -- 操作の結果
CURL の例:
curl \ -d operation=pull \ -H "Authorization: Token TOKEN" \ http://example.com/api/components/hello/weblate/repository/
JSON リクエストの例:
POST /api/components/hello/weblate/repository/ HTTP/1.1 Host: example.com Accept: application/json Content-Type: application/json Authorization: Token TOKEN Content-Length: 20 {"operation":"pull"}
JSON レスポンスの例:
HTTP/1.0 200 OK Date: Tue, 12 Apr 2016 09:32:50 GMT Server: WSGIServer/0.1 Python/2.7.11+ Vary: Accept, Accept-Language, Cookie X-Frame-Options: SAMEORIGIN Content-Type: application/json Content-Language: en Allow: GET, POST, HEAD, OPTIONS {"result":true}
-
GET
/api/components/
(string: project)/
(string: component)/monolingual_base/
¶ Downloads base file for monolingual translations.
- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
-
GET
/api/components/
(string: project)/
(string: component)/new_template/
¶ Downloads template file for new translations.
- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
-
GET
/api/components/
(string: project)/
(string: component)/translations/
¶ Returns a list of translation objects in the given component.
- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
- レスポンス JSON オブジェクト
results (array) -- array of translation objects; see
GET /api/translations/(string:project)/(string:component)/(string:language)/
-
POST
/api/components/
(string: project)/
(string: component)/translations/
¶ Creates new translation in the given component.
- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
- リクエスト JSON オブジェクト
language_code (string) -- translation language code; see
GET /api/languages/(string:language)/
- レスポンス JSON オブジェクト
result (object) -- new translation object created
CURL の例:
curl \ -d language_code=cs \ -H "Authorization: Token TOKEN" \ http://example.com/api/projects/hello/components/
JSON リクエストの例:
POST /api/projects/hello/components/ HTTP/1.1 Host: example.com Accept: application/json Content-Type: application/json Authorization: Token TOKEN Content-Length: 20 {"language_code": "cs"}
JSON レスポンスの例:
HTTP/1.0 200 OK Date: Tue, 12 Apr 2016 09:32:50 GMT Server: WSGIServer/0.1 Python/2.7.11+ Vary: Accept, Accept-Language, Cookie X-Frame-Options: SAMEORIGIN Content-Type: application/json Content-Language: en Allow: GET, POST, HEAD, OPTIONS { "failing_checks": 0, "failing_checks_percent": 0, "failing_checks_words": 0, "filename": "po/cs.po", "fuzzy": 0, "fuzzy_percent": 0.0, "fuzzy_words": 0, "have_comment": 0, "have_suggestion": 0, "is_template": false, "is_source": false, "language": { "code": "cs", "direction": "ltr", "name": "Czech", "url": "http://example.com/api/languages/cs/", "web_url": "http://example.com/languages/cs/" }, "language_code": "cs", "id": 125, "last_author": null, "last_change": null, "share_url": "http://example.com/engage/hello/cs/", "total": 4, "total_words": 15, "translate_url": "http://example.com/translate/hello/weblate/cs/", "translated": 0, "translated_percent": 0.0, "translated_words": 0, "url": "http://example.com/api/translations/hello/weblate/cs/", "web_url": "http://example.com/projects/hello/weblate/cs/" }
-
GET
/api/components/
(string: project)/
(string: component)/statistics/
¶ Returns paginated statistics for all translations within component.
バージョン 2.7 で追加.
- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
- レスポンス JSON オブジェクト
results (array) -- array of translation statistics objects; see
GET /api/translations/(string:project)/(string:component)/(string:language)/statistics/
-
GET
/api/components/
(string: project)/
(string: component)/links/
¶ コンポーネントにリンクしたプロジェクトを返します。
バージョン 4.5 で追加.
- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
- レスポンス JSON オブジェクト
projects (array) -- 関連するプロジェクト; 参照:
GET /api/projects/(string:project)/
-
POST
/api/components/
(string: project)/
(string: component)/links/
¶ プロジェクトをコンポーネントに関連付けます。
バージョン 4.5 で追加.
- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
- フォーム パラメーター
string project_slug -- プロジェクトのスラッグ
-
DELETE
/api/components/
(string: project)/
(string: component)/links/
(string: project_slug)/
¶ コンポーネントとプロジェクトの関連付けを削除します。
バージョン 4.5 で追加.
- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
project_slug (string) -- プロジェクトを削除するスラッグ
翻訳¶
-
GET
/api/translations/
¶ Returns a list of translations.
参考
Translation object attributes are documented at
GET /api/translations/(string:project)/(string:component)/(string:language)/
.
-
GET
/api/translations/
(string: project)/
(string: component)/
(string: language)/
¶ Returns information about a translation.
- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
language (string) -- Translation language code
- レスポンス JSON オブジェクト
component (object) -- component object; see
GET /api/components/(string:project)/(string:component)/
failing_checks (int) -- 検査不合格の文字列の数
failing_checks_percent (float) -- 検査不合格の文字列の割合
failing_checks_words (int) -- 検査不合格の単語の数
filename (string) -- translation filename
fuzzy (int) -- あいまいな(要編集付き)文字列の数
fuzzy_percent (float) -- あいまいな(要編集付き)文字列の割合
fuzzy_words (int) -- number of words in fuzzy (marked for edit) strings
have_comment (int) -- number of strings with comment
have_suggestion (int) -- number of strings with suggestion
is_template (boolean) -- 翻訳が単一言語ベースかどうか
language (object) -- 原文の言語のオブジェクト。参照:
GET /api/languages/(string:language)/
language_code (string) -- language code used in the repository; this can be different from language code in the language object
last_author (string) -- name of last author
last_change (timestamp) -- last change timestamp
revision (string) -- revision hash for the file
share_url (string) -- URL for sharing leading to engagement page
total (int) -- 文字列の総数
total_words (int) -- 単語の総数
translate_url (string) -- URL for translating
translated (int) -- 翻訳済み文字列の数
translated_percent (float) -- 翻訳済みの文字列の割合
translated_words (int) -- 翻訳済みの単語の数
repository_url (string) -- URL to repository status; see
GET /api/translations/(string:project)/(string:component)/(string:language)/repository/
file_url (string) -- URL to file object; see
GET /api/translations/(string:project)/(string:component)/(string:language)/file/
changes_list_url (string) -- URL to changes list; see
GET /api/translations/(string:project)/(string:component)/(string:language)/changes/
units_list_url (string) -- URL to strings list; see
GET /api/translations/(string:project)/(string:component)/(string:language)/units/
JSON データの例:
{ "component": { "branch": "main", "file_format": "po", "filemask": "po/*.po", "git_export": "", "license": "", "license_url": "", "name": "Weblate", "new_base": "", "project": { "name": "Hello", "slug": "hello", "source_language": { "code": "en", "direction": "ltr", "name": "English", "url": "http://example.com/api/languages/en/", "web_url": "http://example.com/languages/en/" }, "url": "http://example.com/api/projects/hello/", "web": "https://weblate.org/", "web_url": "http://example.com/projects/hello/" }, "repo": "file:///home/nijel/work/weblate-hello", "slug": "weblate", "template": "", "url": "http://example.com/api/components/hello/weblate/", "vcs": "git", "web_url": "http://example.com/projects/hello/weblate/" }, "failing_checks": 3, "failing_checks_percent": 75.0, "failing_checks_words": 11, "filename": "po/cs.po", "fuzzy": 0, "fuzzy_percent": 0.0, "fuzzy_words": 0, "have_comment": 0, "have_suggestion": 0, "is_template": false, "language": { "code": "cs", "direction": "ltr", "name": "Czech", "url": "http://example.com/api/languages/cs/", "web_url": "http://example.com/languages/cs/" }, "language_code": "cs", "last_author": "Weblate Admin", "last_change": "2016-03-07T10:20:05.499", "revision": "7ddfafe6daaf57fc8654cc852ea6be212b015792", "share_url": "http://example.com/engage/hello/cs/", "total": 4, "total_words": 15, "translate_url": "http://example.com/translate/hello/weblate/cs/", "translated": 4, "translated_percent": 100.0, "translated_words": 15, "url": "http://example.com/api/translations/hello/weblate/cs/", "web_url": "http://example.com/projects/hello/weblate/cs/" }
-
DELETE
/api/translations/
(string: project)/
(string: component)/
(string: language)/
¶ バージョン 3.9 で追加.
Deletes a translation.
- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
language (string) -- Translation language code
-
GET
/api/translations/
(string: project)/
(string: component)/
(string: language)/changes/
¶ Returns a list of translation changes. This is essentially a translations-scoped
GET /api/changes/
accepting the same parameters.- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
language (string) -- Translation language code
- レスポンス JSON オブジェクト
results (array) -- コンポーネントオブジェクトの配列。参照:
GET /api/changes/(int:id)/
-
GET
/api/translations/
(string: project)/
(string: component)/
(string: language)/units/
¶ Returns a list of translation units.
- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
language (string) -- Translation language code
q (string) -- Search query string 検索 (optional)
- レスポンス JSON オブジェクト
results (array) -- array of component objects; see
GET /api/units/(int:id)/
-
POST
/api/translations/
(string: project)/
(string: component)/
(string: language)/units/
¶ Add new monolingual unit.
- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
language (string) -- Translation language code
- リクエスト JSON オブジェクト
key (string) -- Name of translation unit
value (string) -- The translation unit value
-
POST
/api/translations/
(string: project)/
(string: component)/
(string: language)/autotranslate/
¶ Trigger automatic translation.
- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
language (string) -- Translation language code
- リクエスト JSON オブジェクト
mode (string) -- 自動翻訳モード
filter_type (string) -- Automatic translation filter type
auto_source (string) -- 自動翻訳の参照元
component (string) -- プロジェクトの共有翻訳メモリに協力を有効にして、追加コンポーネントにアクセスします。
engines (string) -- 機械翻訳エンジン
threshold (string) -- スコアしきい値
-
GET
/api/translations/
(string: project)/
(string: component)/
(string: language)/file/
¶ Download current translation file as it is stored in the VCS (without the
format
parameter) or converted to another format (see 翻訳のダウンロード).注釈
This API endpoint uses different logic for output than rest of API as it operates on whole file rather than on data. Set of accepted
format
parameter differs and without such parameter you get translation file as stored in VCS.- クエリ パラメータ
format -- File format to use; if not specified no format conversion happens; supported file formats:
po
,mo
,xliff
,xliff11
,tbx
,csv
,xlsx
,json
,aresource
,strings
- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
language (string) -- Translation language code
-
POST
/api/translations/
(string: project)/
(string: component)/
(string: language)/file/
¶ Upload new file with translations.
- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
language (string) -- Translation language code
- フォーム パラメーター
string conflicts -- How to deal with conflicts (
ignore
,replace-translated
orreplace-approved
)file file -- Uploaded file
string email -- 翻訳者のメールアドレス
string author -- 翻訳者名
string method -- アップロード メソッド(
translate
,approve
,suggest
,fuzzy
,replace
,source
,add
)。参照: インポート方法string fuzzy -- Fuzzy (marked for edit) strings processing (empty,
process
,approve
)
CURL の例:
curl -X POST \ -F file=@strings.xml \ -H "Authorization: Token TOKEN" \ http://example.com/api/translations/hello/android/cs/file/
-
GET
/api/translations/
(string: project)/
(string: component)/
(string: language)/repository/
¶ Returns information about VCS repository status.
The response is same as for
GET /api/components/(string:project)/(string:component)/repository/
.- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
language (string) -- Translation language code
-
POST
/api/translations/
(string: project)/
(string: component)/
(string: language)/repository/
¶ VCS リポジトリで指定の操作を実行します。
See
POST /api/projects/(string:project)/repository/
for documentation.- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
language (string) -- Translation language code
- リクエスト JSON オブジェクト
operation (string) -- 実行する操作:
push
,pull
,commit
,reset
,cleanup
のいずれか一つ
- レスポンス JSON オブジェクト
result (boolean) -- 操作の結果
-
GET
/api/translations/
(string: project)/
(string: component)/
(string: language)/statistics/
¶ Returns detailed translation statistics.
バージョン 2.7 で追加.
- パラメータ
project (string) -- プロジェクト URL スラッグ
component (string) -- コンポーネント URL スラッグ
language (string) -- Translation language code
- レスポンス JSON オブジェクト
code (string) -- 言語コード
failing (int) -- number of failing checks
failing_percent (float) -- percentage of failing checks
fuzzy (int) -- あいまいな(要編集付き)文字列の数
fuzzy_percent (float) -- あいまいな(要編集付き)文字列の割合
total_words (int) -- 単語の総数
translated_words (int) -- 翻訳済みの単語の数
last_author (string) -- name of last author
last_change (timestamp) -- date of last change
name (string) -- 言語名
total (int) -- 文字列の総数
translated (int) -- 翻訳済み文字列の数
translated_percent (float) -- 翻訳済みの文字列の割合
url (string) -- URL to access the translation (engagement URL)
url_translate (string) -- URL to access the translation (real translation URL)
Units¶
A unit is a single piece of a translation which pairs a source string with a corresponding translated string and also contains some related metadata. The term is derived from the Translate Toolkit and XLIFF.
バージョン 2.10 で追加.
-
GET
/api/units/
¶ Returns list of translation units.
参考
Unit object attributes are documented at
GET /api/units/(int:id)/
.
-
GET
/api/units/
(int: id)/
¶ バージョン 4.3 で変更: The
target
andsource
are now arrays to properly handle plural strings.Returns information about translation unit.
- パラメータ
id (int) -- Unit ID
- レスポンス JSON オブジェクト
translation (string) -- URL of a related translation object
source (array) -- 原文
previous_source (string) -- previous source string used for fuzzy matching
target (array) -- target string
id_hash (string) -- unique identifier of the unit
content_hash (string) -- unique identifier of the source string
location (string) -- location of the unit in source code
context (string) -- translation unit context
note (string) -- translation unit note
flags (string) -- translation unit flags
state (int) -- unit state, 0 - not translated, 10 - needs editing, 20 - translated, 30 - approved, 100 - read only
fuzzy (boolean) -- ユニットが "fuzzy" もしは査読用にマークされているか
translated (boolean) -- 単位が翻訳されているかどうか
approved (boolean) -- 翻訳が承認されているかどうか
position (int) -- unit position in translation file
has_suggestion (boolean) -- ユニットに提案があるかどうか
has_comment (boolean) -- ユニットにコメントがあるかどうか
has_failing_check (boolean) -- ユニットに検査で不合格となったものがあるか
num_words (int) -- number of source words
priority (int) -- translation priority; 100 is default
id (int) -- unit identifier
explanation (string) -- String explanation, available on source units, see Additional info on source strings
extra_flags (string) -- 原文ユニットで使用可能な追加の文字列フラグ、参照: フラグを使用した動作の設定
web_url (string) -- URL where the unit can be edited
souce_unit (string) -- Source unit link; see
GET /api/units/(int:id)/
-
PATCH
/api/units/
(int: id)/
¶ バージョン 4.3 で追加.
翻訳ユニットを部分的に更新します。
- パラメータ
id (int) -- Unit ID
- リクエスト JSON オブジェクト
state (int) -- unit state, 0 - not translated, 10 - needs editing, 20 - translated, 30 - approved (need review workflow enabled, see 専任の査読者)
target (array) -- target string
explanation (string) -- String explanation, available on source units, see Additional info on source strings
extra_flags (string) -- 原文ユニットで使用可能な追加の文字列フラグ、参照: フラグを使用した動作の設定
-
PUT
/api/units/
(int: id)/
¶ バージョン 4.3 で追加.
翻訳ユニットをすべて更新します。
- パラメータ
id (int) -- Unit ID
- リクエスト JSON オブジェクト
state (int) -- unit state, 0 - not translated, 10 - needs editing, 20 - translated, 30 - approved (need review workflow enabled, see 専任の査読者)
target (array) -- target string
explanation (string) -- String explanation, available on source units, see Additional info on source strings
extra_flags (string) -- 原文ユニットで使用可能な追加の文字列フラグ、参照: フラグを使用した動作の設定
-
DELETE
/api/units/
(int: id)/
¶ バージョン 4.3 で追加.
翻訳ユニットを削除します。
- パラメータ
id (int) -- Unit ID
変更¶
バージョン 2.10 で追加.
-
GET
/api/changes/
¶ バージョン 4.1 で変更: 変更のフィルター処理は 4.1 リリースで導入しました。
Returns a list of translation changes.
参考
Change object attributes are documented at
GET /api/changes/(int:id)/
.- クエリ パラメータ
user (string) -- Username of user to filters
action (int) -- Action to filter, can be used several times
timestamp_after (timestamp) -- ISO 8601 formatted timestamp to list changes after
timestamp_before (timestamp) -- ISO 8601 formatted timestamp to list changes before
-
GET
/api/changes/
(int: id)/
¶ Returns information about translation change.
- パラメータ
id (int) -- Change ID
- レスポンス JSON オブジェクト
unit (string) -- URL of a related unit object
translation (string) -- URL of a related translation object
component (string) -- URL of a related component object
user (string) -- URL of a related user object
author (string) -- URL of a related author object
timestamp (timestamp) -- event timestamp
action (int) -- numeric identification of action
action_name (string) -- text description of action
target (string) -- event changed text or detail
id (int) -- change identifier
スクリーンショット¶
バージョン 2.14 で追加.
-
GET
/api/screenshots/
¶ Returns a list of screenshot string information.
参考
Screenshot object attributes are documented at
GET /api/screenshots/(int:id)/
.
-
GET
/api/screenshots/
(int: id)/
¶ Returns information about screenshot information.
- パラメータ
id (int) -- Screenshot ID
- レスポンス JSON オブジェクト
name (string) -- name of a screenshot
component (string) -- URL of a related component object
file_url (string) -- URL to download a file; see
GET /api/screenshots/(int:id)/file/
units (array) -- link to associated source string information; see
GET /api/units/(int:id)/
-
GET
/api/screenshots/
(int: id)/file/
¶ Download the screenshot image.
- パラメータ
id (int) -- Screenshot ID
-
POST
/api/screenshots/
(int: id)/file/
¶ Replace screenshot image.
- パラメータ
id (int) -- Screenshot ID
- フォーム パラメーター
file image -- Uploaded file
CURL の例:
curl -X POST \ -F image=@image.png \ -H "Authorization: Token TOKEN" \ http://example.com/api/screenshots/1/file/
-
POST
/api/screenshots/
(int: id)/units/
¶ Associate source string with screenshot.
- パラメータ
id (int) -- Screenshot ID
- フォーム パラメーター
string unit_id -- Unit ID
- レスポンス JSON オブジェクト
name (string) -- name of a screenshot
translation (string) -- URL of a related translation object
file_url (string) -- URL to download a file; see
GET /api/screenshots/(int:id)/file/
units (array) -- link to associated source string information; see
GET /api/units/(int:id)/
-
DELETE
/api/screenshots/
(int: id)/units/
(int: unit_id)¶ スクリーンショットと原文の関連付けを削除します。
- パラメータ
id (int) -- Screenshot ID
unit_id -- 原文ユニット ID
-
POST
/api/screenshots/
¶ Creates a new screenshot.
- フォーム パラメーター
file image -- Uploaded file
string name -- スクリーンショットの名前
string project_slug -- プロジェクトのスラッグ
string component_slug -- コンポーネントのスラッグ
string language_code -- 言語コード
- レスポンス JSON オブジェクト
name (string) -- name of a screenshot
component (string) -- URL of a related component object
file_url (string) -- URL to download a file; see
GET /api/screenshots/(int:id)/file/
units (array) -- link to associated source string information; see
GET /api/units/(int:id)/
-
PATCH
/api/screenshots/
(int: id)/
¶ スクリーンショットに関する部分的な情報を編集します。
- パラメータ
id (int) -- Screenshot ID
- レスポンス JSON オブジェクト
name (string) -- name of a screenshot
component (string) -- URL of a related component object
file_url (string) -- URL to download a file; see
GET /api/screenshots/(int:id)/file/
units (array) -- link to associated source string information; see
GET /api/units/(int:id)/
-
PUT
/api/screenshots/
(int: id)/
¶ スクリーンショットのすべての情報を編集します。
- パラメータ
id (int) -- Screenshot ID
- レスポンス JSON オブジェクト
name (string) -- name of a screenshot
component (string) -- URL of a related component object
file_url (string) -- URL to download a file; see
GET /api/screenshots/(int:id)/file/
units (array) -- link to associated source string information; see
GET /api/units/(int:id)/
-
DELETE
/api/screenshots/
(int: id)/
¶ スクリーンショットを削除します。
- パラメータ
id (int) -- Screenshot ID
アドオン¶
バージョン 4.4.1 で追加.
-
GET
/api/addons/
¶ アドオンの一覧を返します。
参考
アドオン オブジェクトの属性は、
GET /api/addons/(int:id)/
にドキュメントがあります。
-
GET
/api/addons/
(int: id)/
¶ アドオン情報に関する情報を返します。
- パラメータ
id (int) -- アドオン ID
- レスポンス JSON オブジェクト
name (string) -- アドオンの名前
component (string) -- URL of a related component object
configuration (object) -- オプションのアドオン設定
-
POST
/api/components/
(string: project)/
(string: component)/addons/
¶ 新しいアドオンを作成します。
- パラメータ
project_slug (string) -- プロジェクトのスラッグ
component_slug (string) -- コンポーネントのスラッグ
- リクエスト JSON オブジェクト
name (string) -- アドオンの名前
configuration (object) -- オプションのアドオン設定
-
PATCH
/api/addons/
(int: id)/
¶ アドオンに関する部分的な情報を編集します。
- パラメータ
id (int) -- アドオン ID
- レスポンス JSON オブジェクト
configuration (object) -- オプションのアドオン設定
-
PUT
/api/addons/
(int: id)/
¶ アドオンに関する完全な情報を編集します。
- パラメータ
id (int) -- アドオン ID
- レスポンス JSON オブジェクト
configuration (object) -- オプションのアドオン設定
-
DELETE
/api/addons/
(int: id)/
¶ アドオンを削除します。
- パラメータ
id (int) -- アドオン ID
複数のコンポーネント リスト¶
バージョン 4.0 で追加.
-
GET
/api/component-lists/
¶ すべてのコンポーネント リストのリストを返します。
参考
コンポーネント リストのオブジェクト属性は、
GET /api/component-lists/(str:slug)/
にドキュメントがあります。
-
GET
/api/component-lists/
(str: slug)/
¶ コンポーネント リストに関する情報を返します。
- パラメータ
slug (string) -- コンポーネント リストのスラッグ
- レスポンス JSON オブジェクト
name (string) -- コンポーネント リストの名前
slug (string) -- コンポーネント リストのスラッグ
show_dashboard (boolean) -- ダッシュボードに表示するかどうか
components (array) -- 関連するコンポーネントへのリンク。参照:
GET /api/components/(string:project)/(string:component)/
auto_assign (array) -- 自動割り当て規則
-
PUT
/api/component-lists/
(str: slug)/
¶ コンポーネント リストのパラメータを変更します。
- パラメータ
slug (string) -- コンポーネント リストのスラッグ
- リクエスト JSON オブジェクト
name (string) -- コンポーネント リストの名前
slug (string) -- コンポーネント リストのスラッグ
show_dashboard (boolean) -- ダッシュボードに表示するかどうか
-
PATCH
/api/component-lists/
(str: slug)/
¶ コンポーネント リストのパラメータを変更します。
- パラメータ
slug (string) -- コンポーネント リストのスラッグ
- リクエスト JSON オブジェクト
name (string) -- コンポーネント リストの名前
slug (string) -- コンポーネント リストのスラッグ
show_dashboard (boolean) -- ダッシュボードに表示するかどうか
-
DELETE
/api/component-lists/
(str: slug)/
¶ コンポーネント リストを削除します。
- パラメータ
slug (string) -- コンポーネント リストのスラッグ
-
POST
/api/component-lists/
(str: slug)/components/
¶ コンポーネントをコンポーネント リストに関連付けます。
- パラメータ
slug (string) -- コンポーネント リストのスラッグ
- フォーム パラメーター
string component_id -- コンポーネント ID
-
DELETE
/api/component-lists/
(str: slug)/components/
(str: component_slug)¶ コンポーネント リストからコンポーネントの関連付けを解除します。
- パラメータ
slug (string) -- コンポーネント リストのスラッグ
component_slug (string) -- コンポーネントのスラッグ
用語集¶
バージョン 4.5 で変更: 現在、用語集は普通のコンポーネントとして、翻訳と文字列を保存するようになりました。代わりに該当の API を使用してください。
タスク¶
バージョン 4.4 で追加.
-
GET
/api/tasks/
¶ タスクの一覧は現在使用できません。
-
GET
/api/tasks/
(str: uuid)/
¶ タスクに関する情報を返します
- パラメータ
uuid (string) -- タスク UUID
- レスポンス JSON オブジェクト
completed (boolean) -- タスクが完了したかどうか
progress (int) -- タスクの進捗率
result (object) -- タスクの結果または進捗状況の詳細
log (string) -- タスクの履歴
通知フック¶
Notification hooks allow external applications to notify Weblate that the VCS repository has been updated.
You can use repository endpoints for projects, components and translations to
update individual repositories; see
POST /api/projects/(string:project)/repository/
for documentation.
-
GET
/hooks/update/
(string: project)/
(string: component)/
¶ バージョン 2.6 で非推奨: Please use
POST /api/components/(string:project)/(string:component)/repository/
instead which works properly with authentication for ACL limited projects.Triggers update of a component (pulling from VCS and scanning for translation changes).
-
GET
/hooks/update/
(string: project)/
¶ バージョン 2.6 で非推奨: Please use
POST /api/projects/(string:project)/repository/
instead which works properly with authentication for ACL limited projects.Triggers update of all components in a project (pulling from VCS and scanning for translation changes).
-
POST
/hooks/github/
¶ Special hook for handling GitHub notifications and automatically updating matching components.
注釈
GitHub includes direct support for notifying Weblate: enable Weblate service hook in repository settings and set the URL to the URL of your Weblate installation.
参考
- Automatically receiving changes from GitHub
For instruction on setting up GitHub integration
- https://docs.github.com/en/github/extending-github/about-webhooks
Generic information about GitHub Webhooks
ENABLE_HOOKS
For enabling hooks for whole Weblate
-
POST
/hooks/gitlab/
¶ Special hook for handling GitLab notifications and automatically updating matching components.
参考
- Automatically receiving changes from GitLab
For instruction on setting up GitLab integration
- https://docs.gitlab.com/ce/user/project/integrations/webhooks.html
Generic information about GitLab Webhooks
ENABLE_HOOKS
For enabling hooks for whole Weblate
-
POST
/hooks/bitbucket/
¶ Special hook for handling Bitbucket notifications and automatically updating matching components.
参考
- Automatically receiving changes from Bitbucket
For instruction on setting up Bitbucket integration
- https://support.atlassian.com/bitbucket-cloud/docs/manage-webhooks/
Generic information about Bitbucket Webhooks
ENABLE_HOOKS
For enabling hooks for whole Weblate
-
POST
/hooks/pagure/
¶ バージョン 3.3 で追加.
Pagure 通知を処理し、一致するコンポーネントを自動的に更新するための特別なフック。
参考
- Pagure からの変更を自動的に受信
Pagure 統合の設定方法について
- https://docs.pagure.org/pagure/usage/using_webhooks.html
Pagure WEB フックに関する一般的な情報
ENABLE_HOOKS
For enabling hooks for whole Weblate
-
POST
/hooks/azure/
¶ バージョン 3.8 で追加.
Special hook for handling Azure Repos notifications and automatically updating matching components.
参考
- Automatically receiving changes from Azure Repos
For instruction on setting up Azure integration
- https://docs.microsoft.com/en-us/azure/devops/service-hooks/services/webhooks?view=azure-devops
Generic information about Azure Repos Web Hooks
ENABLE_HOOKS
For enabling hooks for whole Weblate
-
POST
/hooks/gitea/
¶ バージョン 3.9 で追加.
Special hook for handling Gitea Webhook notifications and automatically updating matching components.
参考
- Automatically receiving changes from Gitea Repos
For instruction on setting up Gitea integration
- https://docs.gitea.io/en-us/webhooks/
Generic information about Gitea Webhooks
ENABLE_HOOKS
For enabling hooks for whole Weblate
-
POST
/hooks/gitee/
¶ バージョン 3.9 で追加.
Special hook for handling Gitee Webhook notifications and automatically updating matching components.
参考
- Automatically receiving changes from Gitee Repos
For instruction on setting up Gitee integration
- https://gitee.com/help/categories/40
Generic information about Gitee Webhooks
ENABLE_HOOKS
For enabling hooks for whole Weblate
Exports¶
Weblate provides various exports to allow you to further process the data.
-
GET
/exports/stats/
(string: project)/
(string: component)/
¶ - クエリ パラメータ
format (string) -- Output format: either
json
orcsv
バージョン 2.6 で非推奨: Please use
GET /api/components/(string:project)/(string:component)/statistics/
andGET /api/translations/(string:project)/(string:component)/(string:language)/statistics/
instead; it allows access to ACL controlled projects as well.Retrieves statistics for given component in given format.
Example request:
GET /exports/stats/weblate/main/ HTTP/1.1 Host: example.com Accept: application/json, text/javascript
Example response:
HTTP/1.1 200 OK Vary: Accept Content-Type: application/json [ { "code": "cs", "failing": 0, "failing_percent": 0.0, "fuzzy": 0, "fuzzy_percent": 0.0, "last_author": "Michal Čihař", "last_change": "2012-03-28T15:07:38+00:00", "name": "Czech", "total": 436, "total_words": 15271, "translated": 436, "translated_percent": 100.0, "translated_words": 3201, "url": "http://hosted.weblate.org/engage/weblate/cs/", "url_translate": "http://hosted.weblate.org/projects/weblate/main/cs/" }, { "code": "nl", "failing": 21, "failing_percent": 4.8, "fuzzy": 11, "fuzzy_percent": 2.5, "last_author": null, "last_change": null, "name": "Dutch", "total": 436, "total_words": 15271, "translated": 319, "translated_percent": 73.2, "translated_words": 3201, "url": "http://hosted.weblate.org/engage/weblate/nl/", "url_translate": "http://hosted.weblate.org/projects/weblate/main/nl/" }, { "code": "el", "failing": 11, "failing_percent": 2.5, "fuzzy": 21, "fuzzy_percent": 4.8, "last_author": null, "last_change": null, "name": "Greek", "total": 436, "total_words": 15271, "translated": 312, "translated_percent": 71.6, "translated_words": 3201, "url": "http://hosted.weblate.org/engage/weblate/el/", "url_translate": "http://hosted.weblate.org/projects/weblate/main/el/" } ]
RSS フィード¶
Changes in translations are exported in RSS feeds.
-
GET
/exports/rss/
(string: project)/
(string: component)/
(string: language)/
¶ Retrieves RSS feed with recent changes for a translation.
-
GET
/exports/rss/
(string: project)/
(string: component)/
¶ Retrieves RSS feed with recent changes for a component.
-
GET
/exports/rss/
(string: project)/
¶ Retrieves RSS feed with recent changes for a project.
-
GET
/exports/rss/language/
(string: language)/
¶ Retrieves RSS feed with recent changes for a language.
-
GET
/exports/rss/
¶ Retrieves RSS feed with recent changes for Weblate instance.