GitLab Integration (File-based)

The GitLab integration allows you to synchronize files between your GitLab repo and Crowdin Enterprise project.

Note: You will need to install the GitLab integration in your Crowdin account before you can set it up and use it.

There are two possible GitLab integration modes you can choose from:

  • Source and translation files mode – synchronize source and translation files between your GitLab repository and Crowdin Enterprise project.
  • Target file bundles mode – generate and push translation files to your GitLab repository from the Crowdin Enterprise project in the selected format. In this mode, integration pushes translation files and doesn’t sync sources from your repo. In this mode, integration pushes translation files and doesn’t sync sources from your repo.

All translated and approved files will be automatically pushed as a merge request to the l10n branch in the GitLab repository in either of the above modes.

Conectando a Conta do GitLab

  1. Open your project and go to Integrations.
  2. Click on GitLab in the Integrations list.
  3. Click Set Up Integration and select Source and translation files mode or Target file bundles mode from the drop-down list to integrate via your GitLab account.
  4. Then authorize the connection with Crowdin Enterprise on the GitLab side.

In case the repository you need is private, and you have limited or no access to it, please ask the repository owner to provide you with an access token.

Observação: Ao configurar uma integração com um token de acesso, certifique-se de ter a permissão de nível de Mantenedor para o repositório necessário.

Selecionando Repositório

Na caixa de diálogo exibida, selecione seu repositório e branches que devem ser traduzidas. É recomendável alternar Strings Duplicadas para Mostrar em um branch de versão, para que strings idênticas sejam ocultadas entre os branches. Se seus arquivos de origem contiverem strings com identificadores aparentes (chaves), é melhor usar uma versão estrita desta opção. Em outros casos, sinta-se à vontade para usar um regular.

Read more about Duplicate Strings.

When working with GitLab integration in the Target File Bundles Mode, the integration will send the completed translations from your Crowdin Enterprise project without pulling sources from your repo. So when selecting a repository and branches that should be translated, you specify where the integration should put the generated bundles with translations.

Read more about configuring target file bundles for VCS integration.

When you work with private integrations (e.g., integrations with self-hosted VCS), you need to add dedicated Crowdin Enterprise IP addresses to the allowlist to ensure that it operates properly while staying secure.

Read more about IP Addresses.

Branches de Atendimento

When translations are finished and your languages are ready to go live, Crowdin Enterprise sends the merge request with translations to your version control system. For every branch that is under localization, Crowdin Enterprise creates an additional service branch with translations. Não nos comprometemos diretamente com o branch mestre para que você possa verificar as traduções primeiro.

By default, l10n_ is added to the created service branch name. Se necessário, você pode alterá-lo facilmente.

Configurações de Sincronização

To import existing translations from your repo, select one of the following options:

  • One-time translation import after the branch is connected
  • Always import new translations from the repository

By default, the first option is selected to import translations only once. Alternatively, you can clear both options if you don’t want to import translations from your repo.

Por padrão, as fontes não são enviadas para o repositório com as traduções. Although, if you perform a source text review in your Crowdin Enterprise project and would like to push the changes made to your source files on Crowdin Enterprise back to your repo, click Edit, select Push Sources in the integration settings, and click Save.

Há casos em que é necessário desativar temporariamente as traduções de serem enviadas para o repositório. Nessa situação, clique em Editar, desmarque Agendamento de Sincronização nas configurações de integração e clique em Salvar. Quando estiver pronto para sincronizar as traduções com o repositório, selecione Agendamento de Sincronização e clique em Salvar.

A sincronização é processada a cada hora automaticamente. Se necessário, você pode alterar o intervalo de atualização nas configurações de integração. Para configurar a programação de sincronização – clique em Editar, role para baixo até Agendamento de Sincronização, defina o intervalo preferido e clique em Salvar.

Not depending on the synchronization settings, the source files’ changes on the repo will still be synced with Crowdin Enterprise continuously.

Branches para Sincronizar Automaticamente

When you set up the integration, you select existing repository branches to be added to the Crowdin Enterprise project. When you set up the integration, you select existing repository branches to be added to the Crowdin Enterprise project.

Por exemplo, você adiciona um *recurso padrão nas configurações de integração do GitLab. Neste caso, serão adicionados ao projeto os branches futuros que contenham esta palavra no final do título.

Para adicionar um padrão para nomes de branches, siga estas etapas:

  1. Clique em Editar na seção de integração do GitLab.
  2. Na caixa de diálogo exibida, role para baixo até Branches para Sincronizar Automaticamente.
  3. No campo Branches para Sincronizar Automaticamente, use seletores curinga como ‘*’, ‘?’, ‘[set]’, ‘' e outros para identificar os branches necessários.
  4. Clique em Salvar.

Nome do Arquivo de Configuração Padrão

crowdin.yml é o nome de arquivo padrão usado para branches sincronizados automaticamente. Para alterar as configurações padrão, clique em Editar, especifique o nome preferido no campo Nome do arquivo de configuração padrão nas configurações de integração e clique em Salvar.

If you don’t specify your custom configuration file name for automatically synchronized branches, and the integration doesn’t find a configuration file with the default name crowdin.yml in the root of the branch, these branches will be marked in the integration settings with a red icon with an exclamation mark saying “Not Ready. Check the configuration”.

Selecionando Conteúdo para Sincronização

To make integration work, you need to specify which source files should be translated and how Crowdin Enterprise should structure translated files in your repository. If you see a red icon with an exclamation mark next to the service branch name, it means that you haven’t selected any content for synchronization.

There are two ways you can specify content for synchronization:

  • Configuring online
  • Configuring manually by creating a configuration file

Configurando Online

Este procedimento é o mesmo para todas as integrações com sistemas de controle de versão (VCS). Check VCS Integrations: Configuring Online to get to know how to select content for synchronization online.

Criando Arquivo de Configuração

Configuration file crowdin.yml should be stored in the GitLab repository along with each separate branch that you want to translate, so Crowdin Enterprise knows what files exactly should be sent for translations.

Ele deve ter a mesma estrutura exigida para CLI, mas as credenciais do seu projeto não devem ser armazenadas no cabeçalho do arquivo por motivos de segurança.

Read more about creating a configuration file.

Trabalhando com Vários Repositórios em Um Projeto

If you’re working with a multi-platform product that has versions for different operating systems, you may want to connect multiple repositories that contain source files for each operating system. Nesse caso, os recursos de localização (por exemplo, MTs, Glossários) e traduções poderiam ser utilizados de forma mais eficiente, reduzindo o tempo necessário para a localização do projeto.

Para adicionar outro repositório, siga estas etapas:

  1. Open your project and go to Integrations.
  2. Click on GitLab in the Integrations list.
  3. Clique em Adicionar Repositório.
  4. Configure a integração com o novo repositório de acordo com suas necessidades e preferências.

Verificando o Status da Sincronização

Once the integration is set up, all the related information is stored in the Integrations > GitLab section.

Depois que a integração é conectada, as configurações podem ser atualizadas apenas pelo membro do projeto que a configurou. All project managers except the person who configured the integration will see the Edit button disabled with the following message when hovering over it: Integration was configured by {Full Name}.

Por padrão, a sincronização é processada a cada hora automaticamente. If you need to launch the synchronization immediately – click Sync Now. Alternatively, if you need to sync only one branch separately, click on the needed branch and select Sync branch.

GitLab Sync Now

Carregando Traduções do Repositório

By default, the translations stored on the repo are uploaded to Crowdin Enterprise during the first synchronization only. To upload translations to Crowdin Enterprise manually, click next to the Sync Now button, and click Upload Translations. A integração fará o carregamento das traduções existentes para o projeto no Crowdin Enterprise.

Pergunta e resposta

P: Eu tenho uma compilação de aplicativo configurada para ser acionada por cada commit. Since Crowdin commits each translation file in a separate commit, how can I avoid unnecessary application builds triggered by commits from Crowdin?
A: Since VCS integrations in Crowdin use API to commit files but not Git, each file is committed separately.

Aqui estão algumas recomendações que podem ajudar a resolver situações semelhantes:

  • Use a opção export_languages para pular commits de idiomas nos quais você ainda não está interessado. Read more about the Export languages parameter for VCS integrations.
  • Use a marcação [ci skip] nas mensagens de confirmação para pular compilações desnecessárias. Read more about the Commit Message parameter for VCS integrations.
  • Configure o intervalo de sincronização preferido usando Agendamento de Sincronização (por exemplo, defina a sincronização uma vez em 24 horas).
  • O Squash faz commits ao mesclar um branch de localização para manter o histórico do branch mestre limpo e organizado.

Veja Também

Este artigo foi útil?