Weblate の内部構造¶
注釈
この章では、Weblate 内部の基本的な概要を説明します。
Weblate のコード構造の大部分は Django を基に作成しました。
ディレクトリ構造¶
Weblate メイン リポジトリのディレクトリ構造の概要:
docsこのドキュメントのソースコードは、Sphinx を使用して作成しています。
dev-docker開発サーバーを実行する Docker コード。参照: Docker上でローカルに Weblate の実行。
weblateDjango アプリケーションとしての Weblate のソースコード。参照: Weblate の内部構造。
weblate/staticクライアント ファイル(CSS、Javascript および画像)。参照: Weblate フロントエンド。
モジュール¶
Weblate は、複数の Django アプリケーションで構成されています(複数のオプション。参照: オプションの Weblate モジュール)。
accounts
ユーザー アカウント、プロファイル、および通知。
addons
Weblate の動作の詳細設定用のアドオン。参照: アドオン。
api
Django REST framework をベースにした API。
auth
認証とアクセス権。
billing
オプションの 課金 モジュール。
checks
翻訳文字列の 品質検査 モジュール。
fonts
フォント表示検査モジュール。
formats
translate-toolkit をベースにしたファイル形式抽象化レイヤー。
gitexport
オプションの Git エクスポーター モジュール。
lang
言語と複数形のモデルを定義するモジュール。
legal
オプションの Legal module モジュール。
machinery
機械翻訳サービスとの連携。
memory
組み込みの翻訳メモリ。参照: 翻訳メモリ。
screenshots
スクリーンショット管理と OCR モジュール。
trans
翻訳を処理するメイン モジュール。
utils
複数のヘルパー ユーティリティ。
vcs
バージョン管理システムの抽象化。
wladmin
カスタマイズした Django 管理画面。
Background tasks internals¶
ヒント
This section describes Celery task internals. Celery を使用するバックグラウンド タスク describes how to configure Celery to run the tasks.
Weblate uses Celery to execute tasks in the background. Some tasks are event-triggered, and some tasks are schedule-triggered.
The Celery Beat is used for scheduling tasks, and django-celery-beat is used
to store the periodic task schedule in the database. The tasks schedule is
configured in tasks.py in each of the Django apps.
The tasks are consumed using several queues; the routing is configured in
settings.py. The queues were designed to separate different types of
workload:
celeryThe default queue where background tasks are processed.
notifyDelivers notification e-mails, both for events within Weblate and for authentication or registration. This is a separate queue to make e-mail delivery smooth even if there is a backlog of other tasks.
memoryUpdates translation memory entries. The updating queue can be long when importing new strings, and long processing does not matter much here, so having a separate queue avoids blocking other tasks.
backupThe backup tasks cannot be executed in parallel, and a single dedicated worker makes this easier.
translateAutomatic translation tasks are known to take long because they hit external services.