よくある質問

設定について

自動化されたワークフローはどのように作りますか?

Weblate は翻訳に関わるすべてをあなたに代わって半自動的に処理することができます。Weblate にリモートリポジトリへの書き込みを許可すれば、マージの際に競合が生じない限り、人手を介さずに翻訳を反映することができます。

  1. 変更があったら Weblate に通知が行くように、あなたの git リポジトリを設定してください。そのやり方については :ref:`hooks`を参照してください。
  2. Weblate の コンポーネント設定 でプッシュ用の URL を設定してください。これにより Weblate は変更をあなたのリポジトリに送信するようになります。
  3. Weblate の プロジェクトの設定 でコミット時のプッシュを有効にしてください。これにより Weblate で変更がコミットされたら、あなたのリポジトリに送信されるようになります。
  4. :djadmin:`commit_pending`のためのクロンジョブを設定することもできます。

SSHを使ってリポジトリにアクセスするにはどうしたらいいですか?

SSHキーを使えるようにするには Accessing repositories を参照してください。

翻訳のマージの競合はどのように解決したらよいですか?

Weblate とリモートリポジトリの両方で翻訳ファイルを変更すると、時によりマージの際に競合が起こります。翻訳ファイルを変更する前に(例えば msgmerge を実行する前など)、Weblate での変更をマージしてしまうことにより、通常はこれを避けることができます。単に Weblate で保留中の変更をすべてコミットしてください(これは Tools メニューの Repository maintenance で行うことができます)。そのあとリポジトリをマージしてください(自動プッシュを有効にしていない場合)。

あいにくマージ時の競合に出くわしてしまったら、これを解決するいちばん簡単な方法は、すべての競合をあなたのローカルマシンで解消してしまうことです。単に Weblate をリモートリポジトリとして追加してから、あなたのリポジトリにこれをマージし、ここですべての競合を解決してください。そのあとこれを Weblate にプッシュすれば、これ以外には特に何もしなくても、このマージ済みのバージョンが Weblate で使用可能になります。

# Commit all pending changes in Weblate, you can do this in the UI as well
wlc commit
# Lock 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/weblate/website/
# You might need to include credentials in some cases:
git remote add weblate https://username:APIKEY@hosted.weblate.org/git/weblate/website/

# Update weblate remote
git remote update weblate

# Merge Weblate changes
git merge weblate/master

# 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 remotes
git remote add weblate-4.7 https://hosted.weblate.org/git/phpmyadmin/4-7/
git remote add weblate https://hosted.weblate.org/git/phpmyadmin/master/
git remote update weblate-4.7 weblate

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

# Merge master branch
git checkout master
git merge weblate/master
... # Resolve conflicts
git commit

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

翻訳ファイルが Gettext po ファイルの場合は、半自動的な方法でマージ時の競合を解決する方法があります。

Weblate の git リポジトリをローカルにクローンしておきます。同時に、あなた自身のリポジトリを、これもローカルでクローンしてください(つまりあなたのリポジトリのコピーが、元のままのものと作業用のコピーと、ふたつ必要ということです)。

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

# Update weblate remote
git remote update weblate

# Merge Weblate changes
git merge weblate/master

# 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 upstream repository, Weblate will fetch merge from there
git push

複数のブランチを一度に翻訳するにはどうしたらいいですか?

Weblate supports pushing translation changes within one プロジェクトの設定. For every コンポーネント設定 which has it enabled (the default behavior), the change made is automatically propagated to others. This way the translations are kept synchronized even if the branches themselves have already diverged quite a lot and it is not possible to simply merge translation changes between them.

Once you merge changes from Weblate, you might have to merge these branches (depending on your development workflow) discarding differences:

git merge -s ours origin/maintenance

Weblate が使用しているリポジトリをエクスポートするにはどうしたらいいですか?

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.

変更をリモートリポジトリに書き込むにはどのような方法がありますか?

This heavily depends on your setup, Weblate is quite flexible in this area. Here are examples of 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 (eg. by eliminating merge commits), merges changes and tells Weblate to reset the content on the upstream repository.

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

How can I limit Weblate access to translations only 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 with your source code.

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

    git submodule update --remote path/to/translations
    

Please consult git submodule documentation for more details.

How can I check if my Weblate is configured 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 /admin/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 also 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 who has made the translation.

Usage

How do I review others translations?

  • You can subscribe to any changes made in Subscriptions and then check others contributions in email.
  • 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 Source tab to provide feedback on a source string or discuss it with other translators.

How can I use existing translations while translating?

Weblate provides you with several ways to utilize existing translations while translating:

  • You can 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 compendium or similar translation database.
  • You can setup tmserver with all databases you have and let Weblate use it. This is good for cases when you want to use it for several times during translating.
  • 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 in your way, please use a pre-commit hook for that.

For monolingual files (see サポートするフォーマット) Weblate might add new translation units which are present in the template and not in actual translations. It does not however perform any automatic cleanup of stale strings as that might have unexpected outcomes. If you want to do this, please install a pre-commit hook which will handle the cleanup according to your requirements.

Weblate also will not try to update bilingual files in any way, so if you need po files being updated from pot, you need to do it yourself.

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 information about used plural forms or text direction.

You are free to define own languages in the administrative interface, you just need to provide information 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 Update PO files to match POT (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

Fulltext search is too slow

Depending on various conditions (frequency of updates, server restarts and other), the fulltext index might become too fragmented over time. It is recommended to optimize it from time to time:

./manage.py rebuild_index --optimize

In case it does not help (or if you have removed a lot of strings) it might be better to rebuild it from scratch:

./manage.py rebuild_index --clean

参考

rebuild_index

I get "Lock Error" quite often while translating

This is usually caused by concurrent updates to the fulltext index. In case you are running a multi-threaded server (e.g. mod_wsgi), this happens quite often. For such a setup it is recommended to use Celery to perform updates in the background.

Rebuilding index has failed with "No space left on device"

Whoosh uses a temporary directory to build indices. In case you have a small /tmp (eg. using ramdisk), this might fail. Change the temporary directory by passing it as TEMP variable:

TEMP=/path/to/big/temp ./manage.py rebuild_index --clean

参考

rebuild_index

Database operations fail with "too many SQL variables"

This can happen when using theSQLite database as it is not powerful enough for some relations used within Weblate. The only way to fix this is to use some more capable database, see Use powerful database engine for more information.

When accessing the site I get 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 your Weblate. For example:

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

Features

Does Weblate support other VCS than Git and Mercurial?

Weblate currently does not have native support for anything other than Git (with extended support for GitHub and Subversion) and ref:vcs-mercurial, but it is possible to write backends for other VCSes.

You can also use Git remote helpers in Git to access other VCSes.

注釈

For native support of other VCS, Weblate requires distributed VCS and could be probably 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 standard VCS tools you use for code.

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

Why does Weblate force to show 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. If you feel your project should be translated as one, consider merging these po files. It will make life easier even for translators not using Weblate.

注釈

In case there will be big demand for this feature, it might be implemented in future versions, but it's definitely not a priority for now.

Why does Weblate use language codes such sr_Latn or zh_Hant?

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

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