GitLab Integration (String-based)

The GitLab integration allows you to synchronize translations from your Crowdin project to GitLab repo.

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

In string-based projects, GitLab integration exclusively operates in the Target file bundles mode.

Target file bundles mode – generate and push translation files to your GitLab repository from the Crowdin 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 completed translations are collected into bundles and automatically pushed as a merge request to the l10n branch in the GitLab repository.

Conectando a Conta do GitLab

  1. Open your project and go to the Integrations tab.
  2. Click on GitLab in the Integrations list.
  3. Click Set Up Integration to integrate via your GitLab account. GitLab Integration Connecting GitLab
  4. Then authorize the connection with Crowdin on the GitLab side:
    GitLab Integration Authorization

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. Afterward, click Use personal access token and insert the token into the Token field and click Set Up Integration.

Note: When setting up an integration with an access token, ensure that you have the Maintainer level permission to the necessary repo.

Selecionando Repositório

Na caixa de diálogo exibida, selecione seu repositório e branches que devem ser traduzidas.

GitLab Integration Unconfigured

GitLab integration in the Target File Bundles Mode will send the completed translations from your Crowdin 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.

Ao trabalhar com integrações privadas (por exemplo, integrações com VCS auto-hospedado), você precisa adicionar endereços IP Crowdin dedicados à lista de permissões para garantir que ela funcione corretamente enquanto permanece seguro.

Read more about IP Addresses.

Branches de Atendimento

Quando as traduções são concluídas e seus idiomas estão prontos para serem lançados, o Crowdin envia a solicitação de mesclagem com as traduções para o seu sistema de controle de versão. Para cada branch que está em localização, o Crowdin cria um branch de serviço adicional com traduções. 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

Há casos em que é necessário desativar temporariamente as traduções de serem enviadas para o repositório. In this situation, click Edit, clear Sync Schedule in the integration settings, and click Save. When ready to sync translations with the repo, select the Sync Schedule, and click Save.

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. To configure the synchronization schedule – click Edit, scroll down to the Sync Schedule, set the preferred interval, and click Save.

GitLab Sync Settings

Branches para Sincronizar Automaticamente

Ao configurar a integração, você seleciona os branch de repositório existentes a serem adicionadas ao projeto Crowdin. Para adicionar branches futuros do GitLab ao Crowdin automaticamente, crie um padrão para os nomes dos branches nas configurações de integração.

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. Click Edit in the GitLab integration section.
  2. In the appeared dialog, scroll down to the Branches to Sync Automatically.
  3. In the Branches to Sync Automatically field, use wildcard selectors such as ‘*’, ‘?’, ‘[set]’, ‘' and others to identify the necessary branches.
  4. Click Save.
    Branches to Sync Automatically

Nome do Arquivo de Configuração Padrão

crowdin.yml is the default file name that is used for automatically synchronized branches. To change the default settings, click Edit, specify the preferred name in the Default configuration file name field in the integration settings, and click Save.

Default Configuration File Name

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 in the Target file bundles mode, you need to select the required bundles that you want to push to 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). Read more about configuring target file bundles for VCS integration.

Criando Arquivo de Configuração

The configuration file crowdin.yml should be placed in the GitLab repository along with each separate branch you want to push translations to, so that Crowdin knows exactly which translation bundles to send to your repository.

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 store content 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 the Integrations tab.
  2. Click on GitLab in the Integrations list.
  3. Click Add Repository.
  4. Configure a integração com o novo repositório de acordo com suas necessidades e preferências.

GitLab Integration Multiple Repositories

Verificando o Status da Sincronização

Once the integration is set up, all related information is stored in the Integrations tab > 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} ({username}).

Por padrão, a sincronização é processada a cada hora automaticamente. If you need to launch the synchronization immediately – click Sync Now.

GitLab Sync Now

Alternatively, if you need to sync only one branch separately, click on the needed branch and select Sync branch.

GitLab Sync Branch

Q&A

Q: I have an application build configured to be triggered by every 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 the export_languages option to skip commits from languages you’re not interested in yet. 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 the preferred sync interval using Sync Schedule (e.g., set the sync once in 24 hours).
  • O Squash faz commits ao mesclar um branch de localização para manter o histórico do branch mestre limpo e organizado.

Este artigo foi útil?