よくある質問

設定

自動化したワークフローを作成する方法は?

Weblate は翻訳に関するすべての作業を半自動的に処理できます。あなたのリポジトリへのプッシュ権限を与えれば、マージの競合が発生しない限り、操作なしで翻訳が反映されます。

  1. 変更があれば Weblate に通知するように Git リポジトリを設定します、方法は 通知フック を確認してください。

  2. Weblate の Component configuration でプッシュ URL を設定します。これにより、Weblate は変更をリポジトリにプッシュできます。

  3. Weblate の Component configurationコミット時にプッシュする を有効にすると、Weblate で変更が行われるたびに Weblate によりリポジトリに変更がプッシュされます。

SSH 経由でリポジトリに接続する方法は?

SSH 鍵の設定については、リポジトリへの接続 を参照してください。

翻訳のマージの競合を修正する方法は?

マージの競合は、Weblate とアップストリーム リポジトリの両方で翻訳ファイルが同時に変更されたとき、たまに発生します。通常、翻訳ファイルに変更を加える前に(msgmerge を実行する前)Weblate 翻訳をマージすることで、これを回避できます。Weblate に、保留中の翻訳をすべてコミットして(管理 メニューの リポジトリのメンテナンス から操作)、リポジトリをマージするように指示するだけです(自動プッシュが無効のとき)。

マージの競合が既に発生している場合、マシン上のすべての競合をローカルで解決する最も簡単な方法は、Weblate をリモート リポジトリとして追加し、アップストリームにマージして競合を修正することです。変更を元に戻すと、Weblate はそのままでマージされたバージョンを使用できます。

注釈

設定によっては、Weblate リポジトリへの接続には認証が必要となります。Weblate に組み込まれた Git エクスポーター を使用すると、ユーザー名と API キーで認証できます。

# Commit all pending changes in Weblate, you can do this in the UI as well:
wlc commit
# Lock the translation in Weblate, again this can be done in the UI as well:
wlc lock
# Add Weblate as remote:
git remote add weblate https://hosted.weblate.org/git/project/component/
# You might need to include credentials in some cases:
git remote add weblate https://username:APIKEY@hosted.weblate.org/git/project/component/

# Update weblate remote:
git remote update weblate

# Merge Weblate changes:
git merge weblate/main

# Resolve conflicts:
edit …
git add …
…
git commit

# Push changes to upstream repository, Weblate will fetch merge from there:
git push

# Open Weblate for translation:
wlc unlock

Weblate で複数のブランチを使用する場合、すべてのブランチに対して同じ操作をする方法:

# Add and update Weblate remotes
git remote add weblate-one https://hosted.weblate.org/git/project/one/
git remote add weblate-second https://hosted.weblate.org/git/project/second/
git remote update weblate-one weblate-second

# Merge QA_4_7 branch:
git checkout QA_4_7
git merge weblate-one/QA_4_7
... # Resolve conflicts
git commit

# Merge main branch:
git checkout main
git merge weblates-second/main
... # Resolve conflicts
git commit

# Push changes to the upstream repository, Weblate will fetch the merge from there:
git push

gettext PO ファイルの場合、競合を半自動でマージする方法:

Weblate Git リポジトリのローカル クローンを取得して保持します。また、アップストリームの Git リポジトリの最新のローカル クローンも取得します(例: 上流の Git リポジトリのコピーが 2 つ必要。最新のコピーと作業用コピー)。操作方法:

# Add remote:
git remote add weblate /path/to/weblate/snapshot/

# Update Weblate remote:
git remote update weblate

# Merge Weblate changes:
git merge weblate/main

# Resolve conflicts in the PO files:
for PO in `find . -name '*.po'` ; do
    msgcat --use-first /path/to/weblate/snapshot/$PO\
               /path/to/upstream/snapshot/$PO -o $PO.merge
    msgmerge --previous --lang=${PO%.po} $PO.merge domain.pot -o $PO
    rm $PO.merge
    git add $PO
done
git commit

# Push changes to the upstream repository, Weblate will fetch merge from there:
git push

複数のブランチを一度に翻訳する方法は?

Weblateは、1 つの Project configuration 内での変更された翻訳の反映に対応しています。 Component configuration が有効(デフォルトの動作)のコンポーネント間では、行われた変更は自動的に他に反映されます。このようにすると、ブランチ自体がすでにかなり分岐していて、ブランチ間で翻訳の変更が単純にマージできない場合でも翻訳の一貫性が維持されます。

Weblate からの変更をマージしたら、(開発ワークフローに応じて)これらの分岐をマージして、違いを破棄してください。操作方法:

git merge -s ours origin/maintenance

マルチ プラットフォームプロジェクトを翻訳する方法は?

Weblate は、多くのファイル形式(参照: see 対応するファイル形式)に対応しています。最も簡単な方法は、各プラットフォームの本来のファイル形式を使用することです。

すべてのプラットフォーム翻訳ファイルを、1 つのプロジェクト(参照: Adding translation projects and components)のコンポーネントとして追加すると、翻訳の反映機能(デフォルトで有効、無効化するには Component configuration から)を使用して、すべてのプラットフォームの文字列を一度に翻訳します。

Weblate が使用する Git リポジトリをエクスポートする方法は?

リポジトリについて特別なことは何もありません、リポジトリは、ファイル名 vcs/<project>/<component>/ として DATA_DIR ディレクトリの下にあります。このサーバーへの SSH アクセス権がある場合は、リポジトリを直接操作できます。

匿名でアクセスするには、Git サーバーを起動してリポジトリを外部に公開してください。

または、これを自動化するために、Weblate 内部の Git エクスポーター を使用できます。

変更を上流にプッシュする方法の種類は?

これは、Weblate の構成にもよりますが、Weblate は非常に柔軟に対応できます。Weblate で使用するワークフローの例:

  • Weblate に、変更を自動的にプッシュおよびマージさせる(参照: 自動化したワークフローを作成する方法は?)。

  • プッシュを Weblate に手動で指示する(上流リポジトリへのプッシュ アクセス権が必要)。

  • 誰かに、手動で Weblate の git リポジトリから上流リポジトリに変更をマージさせる。

  • 誰かに手動で、Weblate が生成した履歴を書き換えさせ(マージ コミットを削除するなど)、変更をマージし、Weblate が上流リポジトリのコンテンツをリセットするように操作させる。

もちろん、これらすべてを自由に組み合わせてもかまいません。

ソースコードを公開せずに、Weblate へのアクセスを翻訳のみに制限する方法は?

git submodule を使用すると、バージョン管理下に置かれてソースコードから翻訳を分離できます。

  1. 翻訳ファイルを含むリポジトリを作成する。

  2. これをサブモジュールとしてコードに追加する。設定方法:

    git submodule add git@example.com:project-translations.git path/to/translations
    
  3. このリポジトリに Weblate をリンクすると、ソース コードを含むリポジトリへのアクセスは必要ありません。

  4. Weblate での翻訳を使用して、メイン リポジトリを更新する方法:

    git submodule update --remote path/to/translations
    

詳細については、git submodule を確認してください。

Weblate が正しく設定されているかどうかを確認する方法は?

Weblate には、管理画面から確認できる設定検査の機能があります。管理画面の 性能レポート リンクからたどるか、/manage/performance/ の URL を直接開いてください。

なぜすべてのコミットが、Weblate <noreply@weblate.org> でコミットされるのですか?

これは、翻訳コンポーネントの作成時に設定されるデフォルトのコミッタ名です。いつでも管理画面から変更できます。

すべてのコミットの作成者(基となる VCS が対応している場合)は、翻訳をしたユーザーとして正しく記録されます。

リポジトリ内のファイルの移動を、Weblate の履歴を失わずにする方法は?

ファイルの場所を変更した後に、文字列にリンクされた履歴、コメント、またはスクリーンショットを保持するには、これらの文字列が Weblate で削除されないようにすることが必要です。もし、コンポーネントの構成が、以前の古いファイルを指し示している場合は、Weblate のリポジトリの更新時に削除されます。その場合、Weblate はすべての翻訳の削除が必要だと判断します。

これに対する解決策として、Weblate と同期して操作を実行する方法:

  1. 影響を受けるコンポーネントを Weblate でロックする。

  2. 保留中の変更をコミットし、アップストリーム リポジトリにマージする。

  3. 受信側の Web フック Project configuration を無効にする; これにより、リポジトリ内の変更がすぐに反映されなくなります。

  4. リポジトリに必要な変更を加える(例: git mv の使用); 変更を上流のリポジトリにプッシュします。

  5. 新しい設定に合わせて Component configuration を変更する; 設定を変更すると、Weblate は更新されたリポジトリを取得し、既存の文字列を維持しながら変更された場所を通知します。

  6. コンポーネントのロックを解除し、プロジェクトの設定からフックを再度有効化する。

使用方法

他の人の翻訳を確認する方法は?

  • Weblate では、査読のためのワークフローを複数用意しています。参照: 翻訳ワークフロー

  • 通知 を使用して、翻訳文の変更および他の作業をメールで随時確認します。

  • 翻訳画面の下部にある査読ツールを使用して、指定した日付以降に他の翻訳者がした翻訳を確認します。

原文についてのフィードバックの方法は?

翻訳の下部にタブが並んでいます。Comments タブの中で、原文についてフィードバックを提供したり、他の翻訳者と話し合ったりできます。

翻訳中に既存の翻訳を使用する方法は?

  • Weblate 内のすべての翻訳は、共有翻訳メモリを使用します。

  • 既存の翻訳メモリ ファイルを Weblate にインポートできます。

  • インポート機能を使用して、翻訳の概要、提案または査読が必要な翻訳を取り込みます。これは、概要または類似の翻訳データベースを使用した 1 回限りの翻訳に最適な方法です。

  • 所有しているすべてのデータベースに tmserver を導入し、Weblate から使用します。翻訳中に何度も使用する場合に適しています。

  • 他の方法として、関連するすべてのプロジェクトの翻訳を 1 つの Weblate で行うと、自動的に他のプロジェクトからも翻訳を使用できます。

Weblate は翻訳以外の翻訳ファイルを更新しますか?

Weblate は、翻訳ファイルの変更を最小限に抑えようとします。一部のファイル形式では、ファイルを再構築します。ファイルの状態を維持させたい場合は、pre-commit フックを使用してください。

言語の定義はどこにあり、独自の言語の追加方法は?

基本的な言語の定義は、Weblate および 翻訳ツールキットに含まれています。翻訳ツールキットには、150 以上の言語と、複数形やテキストの方向についての情報が含まれています。

管理画面から、独自の言語を自由に定義できます。必要な情報を入力するだけです。

Weblate は、あいまいな文字列の変化を強調表示できますか?

Weblate では、この機能に対応していますが、違いを示すデータが必要です。

Gettext PO ファイルの場合は、PO ファイルの更新時に、--previous パラメーターを msgmerge に渡すことが必要です。更新の例:

msgmerge --previous -U po/cs.po po/phpmyadmin.pot

For monolingual translations, Weblate can find the previous string by ID, so it shows the differences automatically.

Why does Weblate still show old translation strings when I've updated the template?

Weblate does not try to manipulate the translation files in any way other than allowing translators to translate. So it also does not update the translatable files when the template or source code have been changed. You simply have to do this manually and push changes to the repository, Weblate will then pick up the changes automatically.

注釈

It is usually a good idea to merge changes done in Weblate before updating translation files, as otherwise you will usually end up with some conflicts to merge.

For example with gettext PO files, you can update the translation files using the msgmerge tool:

msgmerge -U locale/cs/LC_MESSAGES/django.mo locale/django.pot

In case you want to do the update automatically, you can install add-on POT に合わせて PO ファイルを更新 (msgmerge).

Troubleshooting

Requests sometimes fail with "too many open files" error

This happens sometimes when your Git repository grows too much and you have many of them. Compressing the Git repositories will improve this situation.

The easiest way to do this is to run:

# Go to DATA_DIR directory
cd data/vcs
# Compress all Git repositories
for d in */* ; do
    pushd $d
    git gc
    popd
done

参考

DATA_DIR

When accessing the site I get a "Bad Request (400)" error

This is most likely caused by an improperly configured ALLOWED_HOSTS. It needs to contain all hostnames you want to access on your Weblate. For example:

ALLOWED_HOSTS = ["weblate.example.com", "weblate", "localhost"]

What does mean "There are more files for the single language (en)"?

This typically happens when you have translation file for source language. Weblate keeps track of source strings and reserves source language for this. The additional file for same language is not processed.

  • 原文の言語への翻訳が必要な場合は、コンポーネント設定の 原文の言語 を変更してください。

  • 原文の言語の翻訳ファイルが不必要な場合は、リポジトリから削除してください。

  • 原文の言語の翻訳ファイルが必要だが、Weblate で無効にする場合は、言語フィルター で除外を設定してしてください。

ヒント

You might get similar error message for other languages as well. In that case the most likely reason is that several files map to single language in Weblate.

This can be caused by using obsolete language codes together with new one (ja and jp for Japanese) or including both country specific and generic codes (fr and fr_FR). See 言語コードの解析 for more details.

機能

Does Weblate support other VCSes than Git and Mercurial?

Weblate currently does not have native support for anything other than Git (with extended support for GitHub プル リクエスト, Gerrit and Subversion) and Mercurial, but it is possible to write backends for other VCSes.

You can also use Git リモート ヘルパー in Git to access other VCSes.

Weblate also supports VCS-less operation, see ローカル ファイル.

注釈

For native support of other VCSes, Weblate requires using distributed VCS, and could probably be adjusted to work with anything other than Git and Mercurial, but somebody has to implement this support.

How does Weblate credit translators?

Every change made in Weblate is committed into VCS under the translators name. This way every single change has proper authorship, and you can track it down using the standard VCS tools you use for code.

Additionally, when the translation file format supports it, the file headers are updated to include the translator's name.

Why does Weblate force showing all PO files in a single tree?

Weblate was designed in a way that every PO file is represented as a single component. This is beneficial for translators, so they know what they are actually translating.

バージョン 4.2 で変更: 翻訳者は、プロジェクトのすべてのコンポーネントを、すべての言語に翻訳できます。

Why does Weblate use language codes such sr_Latn or zh_Hant?

These are language codes defined by RFC 5646 to better indicate that they are really different languages instead previously wrongly used modifiers (for @latin variants) or country codes (for Chinese).

Weblate still understands legacy language codes and will map them to current one - for example sr@latin will be handled as sr_Latn or zh@CN as zh_Hans.

注釈

Weblate defaults to POSIX style language codes with underscore, see 言語の定義 for more details.