Integrating with Weblate

Weblate の基本

プロジェクトとコンポーネントの構造

Weblate では、翻訳はプロジェクトとコンポーネントから成ります。各プロジェクトには複数のコンポーネントを含めることができ、コンポーネントにはそれぞれの言語への翻訳が含まれます。コンポーネントは、翻訳可能な 1 つのファイル(例えば GNU gettextAndroid string resources)に対応します。プロジェクトは、コンポーネントを論理的なまとまりに分類する(たとえば、1 つのアプリケーション内で使用するすべての翻訳をグループ化する)のに便利です。

内部ではデフォルトで、各プロジェクトごとに、共通する文字列の翻訳をプロジェクト内の他のコンポーネントに伝播します。これにより、反復や複数バージョンの翻訳の負担を軽減します。翻訳を分岐する場合は、変換の伝播を Component configuration ごとに無効にできます。

現地語化プロジェクトを Weblate にインポートする

Weblate was developed with VCS integration in mind. The easiest approach to integrate with it is to grant access to your VCS repository. The import process will guide you through configuring components with your translations.

In case you do not use VCS or do not want to grant access to your VCS at all, you can use Weblate without a remote VCS repository - it will create local repository with all the translations.

Getting translations updates from Weblate

To fetch updated strings from Weblate you can simply fetch the underlying repository (either from filesystem or it can be made available through Git exporter). Prior to this, you might want to commit any pending changes (see Lazy commits). This can be achieved in the user interface (in the Repository maintenance) or from command line using Weblate クライアント.

This can be automated if you grant Weblate push access to your repository and configure リポジトリの送信先 URL in the Component configuration.

Pushing string changes to Weblate

To push newly updated strings to Weblate, just let it pull from the upstream repository. This can be achieved in the user interface (in the Repository maintenance) or from command line using Weblate クライアント.

This can be automated by installing a webhook on your repository to trigger Weblate whenever there is a new commit, see Updating repositories for more details.

When not using a VCS integration, you can use UI or Weblate's REST API to update translations to match your code base.

新しい文字列の追加

In case your translation files are stored in VCS together with the code, you most likely have existing workflow for developers to introduce new strings. You might extend it by using 原文の品質ゲートウェイ.

When the translation files are separate, there needs to be a way to introduce new strings. Weblate can add new strings on monolingual translations only (see Bilingual and monolingual formats). You have three options to do that: