Integrating with Weblate

Básico do Weblate

Projects and components structure

No Weblate, as traduções são organizadas em projetos e componentes. Cada projeto pode conter vários componentes, os quais contêm traduções para idiomas individuais. O componente corresponde a um arquivo traduzível (por exemplo, GNU gettext ou Android string resources). Os projetos estão lá para ajudá-lo a organizar componentes em conjuntos lógicos (por exemplo, para agrupar todas as traduções usadas dentro de um aplicativo).

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 Commits adiados). This can be achieved in the user interface (in the Repository maintenance) or from command line using Weblate Client.

This can be automated if you grant Weblate push access to your repository and configure URL de push do repositório in the Component configuration.

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 Atualizando repositórios 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 Rota de qualidade para os textos fonte.

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: