よくある質問

設定

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

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

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

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

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

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

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

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

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

If you've already encountered a merge conflict, the easiest way to solve all conflicts locally on your machine, is to add Weblate as a remote repository, merge it into upstream and fix any conflicts. Once you push changes back, Weblate will be able to use the merged version without any other special actions.

注釈

設定によっては、Weblate リポジトリへの接続に認証が必要になることあります。Weblate に標準搭載されている Git exporter を使用すると、ユーザー名と 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 リポジトリのローカル クローンを取得して保持します。また、upstream の Git リポジトリの新しいローカル クローンも取得します(つまり、upstream の 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 内での変更された翻訳のプッシュに対応しています。every Component configuration が有効な場合(デフォルトの動作)、行われた変更は自動的に他に反映されます。このようにすると、分岐自体がすでにかなり分岐している場合でも翻訳の同期が維持されます。分岐間の翻訳の変更は単純にマージできません。

Weblate からの変更をマージするときに、、これらのブランチをマージしてから(開発ワークフローに応じて)差分を破棄することが必要になった場合の方法:

git merge -s ours origin/maintenance

How to translate multi-platform projects?

Weblate supports a wide range of file formats (see 対応するファイル形式) and the easiest approach is to use the native format for each platform.

Once you have added all platform translation files as components in one project (see Adding translation projects and components), you can utilize the translation propagation feature (turned on by default, and can be turned off in the Component configuration) to translate strings for all platforms at once.

How to export the Git repository that Weblate uses?

There is nothing special about the repository, it lives under the DATA_DIR directory and is named vcs/<project>/<component>/. If you have SSH access to this machine, you can use the repository directly.

For anonymous access, you might want to run a Git server and let it serve the repository to the outside world.

Alternatively, you can use Git exporter inside Weblate to automate this.

What are the options for pushing changes back upstream?

This heavily depends on your setup, Weblate is quite flexible in this area. Here are examples of some workflows used with Weblate:

  • Weblate automatically pushes and merges changes (see 自動化したワークフローを作成する方法は?).

  • You manually tell Weblate to push (it needs push access to the upstream repository).

  • Somebody manually merges changes from the Weblate git repository into the upstream repository.

  • Somebody rewrites history produced by Weblate (e.g. by eliminating merge commits), merges changes, and tells Weblate to reset the content in the upstream repository.

Of course you are free to mix all of these as you wish.

How can I limit Weblate access to only translations, without exposing source code to it?

You can use git submodule for separating translations from source code while still having them under version control.

  1. Create a repository with your translation files.

  2. Add this as a submodule to your code:

    git submodule add git@example.com:project-translations.git path/to/translations
    
  3. Link Weblate to this repository, it no longer needs access to the repository containing your source code.

  4. You can update the main repository with translations from Weblate by:

    git submodule update --remote path/to/translations
    

Please consult the git submodule documentation for more details.

How can I check whether my Weblate is set up properly?

Weblate includes a set of configuration checks which you can see in the admin interface, just follow the Performance report link in the admin interface, or open the /manage/performance/ URL directly.

Why are all commits committed by Weblate <noreply@weblate.org>?

This is the default committer name, configured when you create a translation component. You can change it in the administration at any time.

The author of every commit (if the underlying VCS supports it) is still recorded correctly as the user that made the translation.

Usage

How do I review the translations of others?

  • There are several review based workflows available in Weblate, see 翻訳ワークフロー.

  • You can subscribe to any changes made in 通知 and then check others contributions as they come in by e-mail.

  • There is a review tool available at the bottom of the translation view, where you can choose to browse translations made by others since a given date.

How do I provide feedback on a source string?

On context tabs below translation, you can use the Comments tab to provide feedback on a source string, or discuss it with other translators.

How can I use existing translations while translating?

  • Weblate 内のすべての翻訳は、ありがたいことに共有翻訳メモリを使用できます。

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

  • Use the import functionality to load compendium as translations, suggestions or translations needing review. This is the best approach for a one-time translation using a compendium or a similar translation database.

  • You can set up tmserver with all databases you have and let Weblate use it. This is good when you want to use it several times during translation.

  • Another option is to translate all related projects in a single Weblate instance, which will make it automatically pick up translations from other projects as well.

Does Weblate update translation files besides translations?

Weblate tries to limit changes in translation files to a minimum. For some file formats it might unfortunately lead to reformatting the file. If you want to keep the file formatted your way, please use a pre-commit hook for that.

Where do language definitions come from and how can I add my own?

The basic set of language definitions is included within Weblate and Translate-toolkit. This covers more than 150 languages and includes info about plural forms or text direction.

You are free to define your own languages in the administrative interface, you just need to provide info about it.

Can Weblate highlight changes in a fuzzy string?

Weblate supports this, however it needs the data to show the difference.

For Gettext PO files, you have to pass the parameter --previous to msgmerge when updating PO files, for example:

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 addon 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.