Integracja z Weblate#

Podstawy Weblate#

Struktura projektów i komponentów#

W Weblate tłumaczenia są podzielone na projekty i komponenty. Każdy projekt może zawierać wiele komponentów, które zawierają tłumaczenia na poszczególne języki. Komponent odpowiada jednemu przetłumaczonemu plikowi (na przykład GNU gettext PO (Portable Object) lub Zasoby z ciągami Androida). Projekty służą do organizowania komponentów w logiczne zestawy (na przykład do grupowania wszystkich tłumaczeń używanych w jednej aplikacji).

Wewnętrznie, każdy projekt ma tłumaczenia wspólnych ciągów propagowane domyślnie w innych komponentach w jego obrębie. Zmniejsza to obciążenie związane z wielokrotnym tłumaczeniem wielu wersji. Propagacja tłumaczeń może być wyłączona dla każdego komponentu za pomocą Zezwól na propagację tłumaczenia w przypadku, gdy tłumaczenia powinny się różnić.

Repository integration#

Weblate is built to integrate with upstream version control repository, Ciągła lokalizacja describes building blocks and how the changes flow between them.

Zobacz także

Architecture overview describes how Weblate works internally.

User attribution#

Weblate keeps the translations properly authored by translators in the version control repository by using name and e-mail. Having a real e-mail attached to the commit follows the distributed version control spirits and allows services like GitHub to associate your contributions done in Weblate with your GitHub profile.

This feature also brings in risk of misusing e-mail published in the version control commits. Moreover, once such a commit is published on public hosting (such as GitHub), there is effectively no way to redact it. Weblate allows choosing a private commit e-mail in Konto to avoid this.

Therefore, admins should consider this while configuring Weblate:

Importowanie projektu lokalizacyjnego do 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.

Pobieranie zaktualizowanych tłumaczeń z Weblate#

Weblate stores updated strings in a database and commits them to a local version control repository. You can add Weblate repository (when Eksporter Git is turned on) as additional remote and fetch translations update from it.

Prior to this, you might want to commit any pending changes (see Leniwe zatwierdzenia). You can do so in the user interface (in the Repository maintenance) or from the command-line using Klient Weblate.

Pushing changes can be automated if you grant Weblate push access to your repository and configure URL repozytorium dla push in the Konfiguracja komponentu, see Wypychanie zmian z Weblate.

Alternatively, you can use REST API Weblate to update translations to match their latest version.

Pobieranie zdalnych zmian do 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 Klient Weblate.

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

If you’re not using a VCS integration, you can use UI or REST API Weblate to update translations to match your code base.

Dodawanie nowych ciągów#

If your translation files are stored in a remote 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 Quality gateway for the source strings to avoid introducing errors.

When translation files are separated from the code, the following ways can introduce new strings into Weblate.

Informacja

The ability to add strings in Weblate requires Zarządzaj ciągami.

Aktualizowanie plików języka docelowego#

For monolingual files (see Obsługiwane formaty plików) Weblate might add new translation strings not present in the Jednojęzyczny bazowy plik języka, 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 Wyczyść pliki tłumaczenia add-on 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 using Update source strings Metody importu or using Zaktualizuj pliki PO, aby dopasować POT (msgmerge) add-on.

Introducing new strings#

You can add new strings in Weblate with Zarządzaj ciągami turned on, but it is usually better to introduce new strings together with the code changes that introduced them.

Monolingual formats need addition of the new string to Jednojęzyczny bazowy plik języka. This is typically done by the developers during developing the code. You might want to introduce review of those strings using Quality gateway for the source strings.

Bilingual formats typically extract strings from the source code using some tooling (like xgettext or intltool-update). Follow your localization framework documentation for instructions how to do that. Once the strings are extracted, there might be an additional step needed to update existing translations, see Aktualizowanie plików języka docelowego.

Podpowiedź

Automating string extraction is presently out of scope for Weblate. It typically involves executing untrusted code what makes it more suitable for a generic continuous integration than localization-specific platform.

You might want to integrate this into your continuous integration pipelines to make new strings automatically appear for translation. Such pipeline should also cover Unikanie konfliktów scalania.

Zarządzanie repozytorium kontroli wersji#

Weblate stores all translation the version control repository. It can be either connected to upstream one, or it can be only internal. The Repository maintenance lets you manipulate with the repository.

Podpowiedź

With Ciągła lokalizacja the repository is automatically pushed whenever there are changes and there is usually no need to manually manipulate with it.

../_images/component-repository.webp