Integrating with Weblate¶
Projects and components structure¶
In Weblate translations are organized into projects and components. Each project can contain number of components and those contain translations into individual languages. The component corresponds to one translatable file (for example GNU gettext or Android string resources). The projects are there to help you organize component into logical sets (for example to group all translations used within one application).
Internally, each project has translations to common strings propagated across other components within it by default. This lightens the burden of repetitive and multi version translation. The translation propagation can be disabled per Component configuration in case the translations should diverge.
Importing localization project into Weblate¶
Weblate was developed with VCS integration in mind. The easiest approach to integrate with it is to grant access to your VCS repository. The import process will guide you through configuring components with your translations.
In case you do not use VCS or do not want to grant access to your VCS at all, you can use Weblate without a remote VCS repository - it will create local repository with all the translations.
Getting translations updates from Weblate¶
To fetch updated strings from Weblate you can simply fetch the underlying repository (either from filesystem or it can be made available through Git exporter). Prior to this, you might want to commit any pending changes (see Lazy commits). This can be achieved in the user interface (in the Repository maintenance) or from command line using Weblate Client.
Pushing string changes to Weblate¶
To push newly updated strings to Weblate, just let it pull from the upstream repository. This can be achieved in the user interface (in the Repository maintenance) or from command line using Weblate Client.
This can be automated by installing a webhook on your repository to trigger Weblate whenever there is a new commit, see Updating repositories for more details.
When not using a VCS integration, you can use UI or Weblate’s REST API to update translations to match your code base.
Adding new strings¶
In case your translation files are stored in VCS together with the code, you most likely have existing workflow for developers to introduce new strings. You might extend it by using Quality gateway for the source strings.
When the translation files are separate, there needs to be a way to introduce new strings. Weblate can add new strings on monolingual translations only (see Bilingual and monolingual formats). You have three options to do that:
Manually, using Add new translation string from Tools menu on source language translation.
Programatically, using API
By uploading source file as Replace existing translation file (this overwrites existing strings, so please make sure the file includes both old and new ones, see Import methods).