Integrating with Weblate

Weblate の基本

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

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

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

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

Weblate has been developed with VCS integration in mind as it’s core feature, so the easiest way is to grant Weblate the access to your repository. The import process will guide you through configuring your translations into components.

Alternatively, you can use Weblate to set up a local repository containing all the translations without integration.

Fetching updated translations from Weblate

To fetch updated strings from Weblate, you can simply fetch the underlying Git 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). You can do so in the user interface (in the Repository maintenance) or from the command line using Weblate クライアント.

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

Alternateively, you can use Weblate's REST API to update translations to match their latest version.

Fetching remote changes into Weblate

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

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

If you’re 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 a VCS together with the code, you most likely have an existing workflow for developers to introduce new strings. Any way of adding strings will be picked up, but consider using 原文の品質ゲートウェイ to avoid introducing errors.

When the translation files are separate from the code, there are following ways to introduce new strings into Weblate. For now, Weblate can intorduce new strings only to monolingual translations (check Bilingual and monolingual formats).