Integrating with Weblate
Bases de Weblate
Structure du projet et des composants
Dans Weblate, les traductions sont organisées en projets et composants. Chaque projet peut contenir un certain nombre de composants et ceux-ci contiennent des traductions dans des langues individuelles. Le composant correspond à un fichier traduisible (par exemple GNU gettext ou Android string resources). Les projets sont là pour vous aider à organiser les composants en ensembles logiques (par exemple pour regrouper toutes les traductions utilisées dans une application).
En interne, chaque projet dispose par défaut de traductions de chaînes communes qui se propagent à travers les autres composants du projet. Cela allège le fardeau de la traduction répétitive et multiversion. La propagation de la traduction peut être désactivée par Configuration des composants en utilisant Permettre la propagation de la traduction au cas où les traductions devraient diverger.
Importation d’un projet de localisation dans 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.
Récupérer les traductions mises à jour depuis Weblate
To fetch updated strings from Weblate, you can simply fetch the underlying Git repository (either from filesystem, or it can be made available through Exportateur Git). Prior to this, you might want to commit any pending changes (see Archivages lazy). You can do so in the user interface (in the Repository maintenance) or from the command-line using Client Weblate.
This can be automated if you grant Weblate push access to your repository and configure URL pour l’envoi du dépôt in the Configuration des composants, see Pushing changes from Weblate.
Alternatively, you can use API REST de Weblate to update translations to match their latest version.
Récupérer les modifications distantes dans 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 Client Weblate.
This can be automated by setting a webhook in your repository to trigger Weblate whenever there is a new commit, see Mise à jour des dépôts for more details.
If you’re not using a VCS integration, you can use UI or API REST de Weblate to update translations to match your code base.
Voir aussi
Ajout de nouvelles chaînes
In case your translation files are stored in a 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 the translation files are separate from the code, there are following ways to introduce new strings into Weblate.
Manually, using Add new translation string from Tools menu in the source language.
Par programmation, en utilisant API
POST /api/translations/(string:project)/(string:component)/(string:language)/units/
.By uploading source file as Replace existing translation file (this overwrites existing strings, so please make sure the file includes both old and new strings) or Add new strings, see Import methods.
Note
Availability of adding strings in Weblate depends on Gérer les chaînes.
Mise à jour des fichiers de langue cible
For monolingual files (see Formats de fichiers pris en charge) Weblate might add new translation strings not present in the Fichier de langue de base mono-langue, 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 Nettoyer les fichiers de traduction 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 Import methods or using
Mettre à jour les fichiers PO afin qu’ils correspondent au POT (msgmerge) add-on.
Managing version control repository
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.
Indication
With Traduction en continu the repository is automatically pushed whenever there are changes and there is usually no need to manually manipulate with it.

Following operations are available:
Commit
Commits any pending changes present in Weblate database and not in the repository, see Archivages lazy.
Push
Pushes changes to the upstream repository, if configured by URL pour l’envoi du dépôt.
Update, Pull, Rebase
Updates Weblate repository with upstream changes. It uses Style de fusion when choosing Update or you can choose different one from the dropdown menu.
Lock
Le verrouillage interdit aux traducteurs d’effectuer des modifications
Reset from Maintenance
Resets any changes done in Weblate to match upstream repository. This will discard all translations done in Weblate and not present in the upstream repository.
Cleanup from Maintenance
Removes untracked files from the repository. These could be result of misbehaving add-ons or bugs.
Force synchronization from Maintenance
Forces writing all strings to the translation files. Use this when repository files became out of sync with Weblate for some reason.