2020-10-30 14:08:56 -04:00
---
2020-11-17 10:09:28 -05:00
stage: Manage
group: Import
2020-11-26 01:09:20 -05:00
info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
2020-10-30 14:08:56 -04:00
---
2021-11-22 01:09:46 -05:00
# Merging translations from Crowdin
2018-09-26 08:30:08 -04:00
2021-11-22 01:09:46 -05:00
Crowdin automatically syncs the `gitlab.pot` file with the Crowdin service, presenting
2019-10-24 23:06:02 -04:00
newly added externalized strings to the community of translators.
2018-09-26 08:30:08 -04:00
2021-11-22 01:09:46 -05:00
The [GitLab Crowdin Bot ](https://gitlab.com/gitlab-crowdin-bot ) also creates merge requests
2019-10-24 23:06:02 -04:00
to take newly approved translation submissions and merge them into the `locale/<language>/gitlab.po`
2021-06-02 05:09:46 -04:00
files. Check the [merge requests created by `gitlab-crowdin-bot` ](https://gitlab.com/gitlab-org/gitlab/-/merge_requests?scope=all&state=opened&author_username=gitlab-crowdin-bot )
2019-10-22 11:06:06 -04:00
to see new and merged merge requests.
2018-09-26 08:30:08 -04:00
## Validation
2021-11-22 01:09:46 -05:00
By default Crowdin commits translations with `[skip ci]` in the commit
2021-05-21 14:11:01 -04:00
message. This avoids an excessive number of pipelines from running.
Before merging translations, make sure to trigger a pipeline to validate
2021-11-22 01:09:46 -05:00
translations. Static analysis validates things Crowdin doesn't do. Create
2021-05-21 14:11:01 -04:00
a new pipeline at [`https://gitlab.com/gitlab-org/gitlab/pipelines/new` ](https://gitlab.com/gitlab-org/gitlab/pipelines/new )
2021-07-08 14:09:32 -04:00
(requires the Developer role) for the `master-i18n` branch.
2018-09-26 08:30:08 -04:00
If there are validation errors, the easiest solution is to disapprove
2021-11-22 01:09:46 -05:00
the offending string in Crowdin, leaving a comment with what is
2021-05-21 14:11:01 -04:00
required to fix the errors. There's an
2020-05-21 02:08:25 -04:00
[issue ](https://gitlab.com/gitlab-org/gitlab/-/issues/23256 )
2021-05-21 14:11:01 -04:00
that suggests automating this process. Disapproving excludes the
invalid translation. The merge request is then updated within a few
2018-09-26 08:30:08 -04:00
minutes.
2021-05-21 14:11:01 -04:00
If the translation fails validation due to angle brackets (`< ` or `>` ),
2021-11-22 01:09:46 -05:00
it should be disapproved in Crowdin. Our strings must use [variables ](externalization.md#html )
2021-05-21 14:11:01 -04:00
for HTML instead.
2020-07-22 08:09:42 -04:00
2021-11-22 01:09:46 -05:00
It might be useful to pause the integration on the Crowdin side for a
2021-05-21 14:11:01 -04:00
moment so translations don't keep coming. You can do this by clicking
2021-11-22 01:09:46 -05:00
**Pause sync** on the [Crowdin integration settings page ](https://translate.gitlab.com/project/gitlab-ee/settings#integration ).
2018-09-26 08:30:08 -04:00
## Merging translations
2021-04-05 17:09:19 -04:00
After all translations are determined to be appropriate and the pipelines pass,
you can merge the translations into the default branch. When merging translations,
2021-11-22 01:09:46 -05:00
be sure to select the **Remove source branch** checkbox. This causes Crowdin
2021-05-21 14:11:01 -04:00
to recreate the `master-i18n` branch from the default branch after merging the new
2021-04-05 17:09:19 -04:00
translation.
2018-09-26 08:30:08 -04:00
2020-05-21 02:08:25 -04:00
We are discussing [automating this entire process ](https://gitlab.com/gitlab-org/gitlab/-/issues/19896 ).
2018-09-26 08:30:08 -04:00
## Recreate the merge request
2021-11-22 01:09:46 -05:00
Crowdin creates a new merge request as soon as the old one is closed
2020-12-07 13:10:36 -05:00
or merged. But it does not recreate the `master-i18n` branch every
2021-11-22 01:09:46 -05:00
time. To force Crowdin to recreate the branch, close any [open merge requests ](https://gitlab.com/gitlab-org/gitlab/-/merge_requests?scope=all&state=opened&author_username=gitlab-crowdin-bot )
2021-05-21 14:11:01 -04:00
and delete the [`master-18n` ](https://gitlab.com/gitlab-org/gitlab/-/branches/all?utf8=✓&search=master-i18n ) branch.
2018-09-26 08:30:08 -04:00
This might be needed when the merge request contains failures that
2021-04-05 17:09:19 -04:00
have been fixed on the default branch.
2020-06-10 20:08:35 -04:00
2021-11-22 01:09:46 -05:00
## Recreate the GitLab integration in Crowdin
2020-06-10 20:08:35 -04:00
2020-12-04 16:09:29 -05:00
NOTE:
2020-06-10 20:08:35 -04:00
These instructions work only for GitLab Team Members.
2021-11-22 01:09:46 -05:00
If for some reason the GitLab integration in Crowdin doesn't exist, you can
2021-02-03 16:09:17 -05:00
recreate it with the following steps:
1. Sign in to GitLab as `gitlab-crowdin-bot` . (If you're a GitLab Team Member,
find credentials in the GitLab shared
[1Password account ](https://about.gitlab.com/handbook/security/#1password-for-teams ).)
2021-11-22 01:09:46 -05:00
1. Sign in to Crowdin with the GitLab integration.
2021-02-03 16:09:17 -05:00
1. Go to **Settings > Integrations > GitLab > Set Up Integration** .
1. Select the `gitlab-org/gitlab` repository.
2021-05-21 14:11:01 -04:00
1. In **Select Branches for Translation** , select `master` .
1. Ensure the **Service Branch Name** is `master-i18n` .
2021-05-09 20:10:37 -04:00
## Manually update the translation levels
2021-11-22 01:09:46 -05:00
There's no automated way to pull the translation levels from Crowdin, to display
2021-05-09 20:10:37 -04:00
this information in the language selection dropdown. Therefore, the translation
levels are hard-coded in the `TRANSLATION_LEVELS` constant in [`i18n.rb` ](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/i18n.rb ),
and must be regularly updated.
2021-05-25 14:10:42 -04:00
To update the translation levels:
1. Get the translation levels (percentage of approved words) from [Crowdin ](https://crowdin.com/project/gitlab-ee/settings#translations ).
1. Update the hard-coded translation levels in [`i18n.rb` ](https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/i18n.rb#L40 ).