Integrando com Weblate

Básico do Weblate

Estrutura de projetos e componentes

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 Recurso de textos de Android). 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).

Internamente, cada projeto tem traduções para textos comuns propagados em outros componentes dentro dele por padrão. Isso alivia o fardo da tradução repetitiva e de várias versões. A propagação da tradução pode ser desabilitada por Configuração de componente usando Permitir propagação de tradução caso as traduções devam divergir.

Importing localization project into 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.

Obtendo traduções atualizadas do 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 Exportador git). Prior to this, you might want to commit any pending changes (see Commits adiados). You can do so in the user interface (in the Repository maintenance) or from the 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 Configuração de componente, see Fazendo push das alterações do Weblate.

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

Fetching remote changes into 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 Weblate Client.

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

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

Adding new strings

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 Rota de qualidade para os textos fonte to avoid introducing errors.

When the translation files are separate from the code, there are following ways to introduce new strings into Weblate.

Nota

Availability of adding strings in Weblate depends on Gerenciar textos.

Atualizando arquivos de idioma de destino

For monolingual files (see Formatos de arquivos suportados) Weblate might add new translation strings not present in the Arquivo de idioma da base monolíngue, 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 Limpar arquivos de tradução addon 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 Métodos de importação or using Atualizar arquivos PO para corresponder ao POT (msgmerge) addon.