Поширені питання та відповіді на них

Налаштування

Як створити автоматизовану процедуру?

Weblate can handle all the translation things semi-automatically for you. If you give it push access to your repository, the translations can happen without interaction, unless some merge conflict occurs.

  1. Set up your Git repository to tell Weblate when there is any change, see Обробники сповіщень for info on how to do it.

  2. Set a push URL at your Налаштовування складників in Weblate, this allows Weblate to push changes to your repository.

  3. Turn on push-on-commit on your Налаштування проєкту in Weblate, this will make Weblate push changes to your repository whenever they happen at Weblate.

Як отримувати доступ до сховища за допомогою SSH?

Будь ласка, ознайомтеся із розділом Доступ до сховищ, щоб дізнатися більше про налаштовування ключів SSH.

Як виправляти конфлікти об’єднання у перекладах?

Merge conflicts happen from time to time when the translation file is changed in both Weblate and the upstream repository concurrently. You can usually avoid this by merging Weblate translations prior to making changes in the translation files (e.g. before running msgmerge). Just tell Weblate to commit all pending translations (you can do it in Repository maintenance in the Manage menu) and merge the repository (if automatic push is not on).

If you’ve already ran into a merge conflict, the easiest way is to solve all conflicts locally at your workstation - is to simply 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.

Примітка

Depending on your setup, access to the Weblate repository might require authentication. When using the built in Засіб експортування Git in Weblate, you authenticate with your username and the API key.

# 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/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

If you’re using multiple branches in Weblate, you can do the same to all of them:

# 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 master branch:
git checkout master
git merge weblates-second/master
... # Resolve conflicts
git commit

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

In case of gettext PO files, there is a way to merge conflicts in a semi-automatic way:

Fetch and keep a local clone of the Weblate Git repository. Also get a second fresh local clone of the upstream Git repository (i. e. you need two copies of the upstream Git repository: An intact and a working copy):

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

Як налаштувати одночасний переклад у декількох гілках розробки?

Weblate supports pushing translation changes within one Налаштування проєкту. For every Налаштовування складників which has it turned on (the default behavior), the change made is automatically propagated to others. This way 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 передбачено підтримку широкого діапазону форматів файлів (див. Підтримувані формати файлів), і найпростішим підходом є використання природного формату для кожної з платформ.

Після додавання усіх файлів перекладу для платформи як складників до одного проєкту (див. Додавання проєктів і складників перекладу) ви можете скористатися можливістю поширення перекладів (типово увімкнено, можна вимкнути на рівні Налаштовування складників) для перекладу рядків для усіх платформ одночасно.

Як експортувати сховище Git, яке використовує Weblate?

У цьому сховищі немає нічого особливого — воно зберігається у каталозі DATA_DIR і має назву vcs/<проєкт>/<складник>/. Якщо ви маєте SSH-доступ до відповідного комп’ютера, ви можете використовувати сховище безпосередньо.

Для анонімного доступу вам варто запустити сервер Git і налаштувати його на обслуговування сховища для усіх інших користувачів.

Крім того, ви можете скористатися Засіб експортування Git у Weblate для автоматизації процесу.

Якими є варіанти надсилання змін назад до основного сховища?

Це значним чином залежить від ваших налаштувань — Weblate є доволі гнучким у цьому сенсі. Ось приклади деяких варіантів робочого процесу, яким можна скористатися у Weblate:

  • Weblate автоматично надсилає і об’єднує зміни (див. Як створити автоматизовану процедуру?).

  • Ви наказуєте Weblate надіслати зміни вручну (це потребує доступ до запису до основного сховища).

  • Хтось вручну об’єднує зміни зі сховища git Weblate до основного сховища.

  • Хтось перезаписує журнал, який створюється Weblate (наприклад, шляхом вилучення внесків із об’єднанням), об’єднує зміни і повідомляє Weblate, що слід відновити початковий стан у основному сховищі.

Звичайно ж, ви можете використовувати будь-яке поєднання описаних вище варіантів.

Як обмежити доступ Weblate лише перекладами без надання системі доступу до початкового коду?

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

  1. Створіть сховище із вашими файлами перекладів.

  2. Додайте його як підлеглий модуль до вашого коду:

    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.

Чому усі внески підписано 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.

Користування

How do I review the translations of others?

  • 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 Source tab to provide feedback on a source string, or discuss it with other translators.

How can I use existing translations while translating?

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

For monolingual files (see Підтримувані формати файлів) Weblate might add new translation strings not 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.

Звідки беруться визначення мов і як можна додати власне визначення?

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.

Чи може Weblate підсвічувати зміни у неточно перекладеному рядку?

У Weblate передбачено підтримку цієї можливості, але програмі потрібні дані для показу відмінностей.

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 Оновити файли po, порівнявши із pot (msgmerge).

Вирішення проблем

Іноді запити не виконуються із повідомленням про помилку «відкрито забагато файлів»

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

Найпростішим способом зробити це є така команда:

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

  • In case the translation to the source language is desired, please change the Джерельна мова in the project settings.

  • Якщо файл перекладу для початкової мови є непотрібним, будь ласка вилучіть його зі сховища.

  • Якщо файл перекладу для початкової мови є бажаним, але Weblate має його ігнорувати, будь ласка, скоригуйте Фільтр мов, щоб виключити його.

Можливості

Чи передбачено у Weblate підтримку інших систем керування версіями, окрім Git і Mercurial?

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

Крім того, ви можете скористатися Git remote helpers у Git для доступу до інших систем керування версіями.

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.

Як Weblate зберігає авторство перекладів?

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. 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 is great demand for this feature, it might be implemented in future versions.

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