debian-mirror-gitlab/doc/development/i18n/merging_translations.md

88 lines
4.2 KiB
Markdown
Raw Normal View History

2021-01-29 00:20:46 +05:30
---
stage: Manage
group: Import
2021-02-22 17:27:13 +05:30
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
2021-01-29 00:20:46 +05:30
---
2020-04-22 19:07:51 +05:30
# Merging translations from CrowdIn
2018-12-05 23:21:45 +05:30
2020-04-22 19:07:51 +05:30
CrowdIn automatically syncs the `gitlab.pot` file with the CrowdIn service, presenting
2019-12-26 22:10:19 +05:30
newly added externalized strings to the community of translators.
2018-12-05 23:21:45 +05:30
2020-04-22 19:07:51 +05:30
[GitLab CrowdIn Bot](https://gitlab.com/gitlab-crowdin-bot) also creates merge requests
2019-12-26 22:10:19 +05:30
to take newly approved translation submissions and merge them into the `locale/<language>/gitlab.po`
2020-03-13 15:44:24 +05:30
files. Check the [merge requests created by `gitlab-crowdin-bot`](https://gitlab.com/gitlab-org/gitlab/-/merge_requests?scope=all&utf8=%E2%9C%93&state=opened&author_username=gitlab-crowdin-bot)
2019-12-26 22:10:19 +05:30
to see new and merged merge requests.
2018-12-05 23:21:45 +05:30
## Validation
2020-04-22 19:07:51 +05:30
By default CrowdIn commits translations with `[skip ci]` in the commit
2018-12-05 23:21:45 +05:30
message. This is done to avoid a bunch of pipelines being run. Before
merging translations, make sure to trigger a pipeline to validate
2020-04-22 19:07:51 +05:30
translations, we have static analysis validating things CrowdIn
2019-12-21 20:55:43 +05:30
doesn't do. Create a new pipeline at `https://gitlab.com/gitlab-org/gitlab/pipelines/new`
(need Developer access permissions) for the `master-i18n` branch.
2018-12-05 23:21:45 +05:30
If there are validation errors, the easiest solution is to disapprove
2020-04-22 19:07:51 +05:30
the offending string in CrowdIn, leaving a comment with what is
2018-12-05 23:21:45 +05:30
required to fix the offense. There is an
2020-06-23 00:09:42 +05:30
[issue](https://gitlab.com/gitlab-org/gitlab/-/issues/23256)
2021-02-22 17:27:13 +05:30
suggesting to automate this process. Disapproving excludes the
invalid translation, the merge request is then updated within a few
2018-12-05 23:21:45 +05:30
minutes.
2020-10-24 23:57:45 +05:30
If the translation has failed validation due to angle brackets `<` or `>`
it should be disapproved on CrowdIn as our strings should be
using [variables](externalization.md#html) for HTML instead.
2020-04-22 19:07:51 +05:30
It might be handy to pause the integration on the CrowdIn side for a
2018-12-05 23:21:45 +05:30
little while so translations don't keep coming. This can be done by
2020-04-22 19:07:51 +05:30
clicking `Pause sync` on the [CrowdIn integration settings
2018-12-05 23:21:45 +05:30
page](https://translate.gitlab.com/project/gitlab-ee/settings#integration).
## Merging translations
2021-04-29 21:17:54 +05:30
After all translations are determined to be appropriate and the pipelines pass,
you can merge the translations into the default branch. When merging translations,
be sure to select the **Remove source branch** check box, which causes CrowdIn
to recreate the `master-i18n` from the default branch after merging the new
translation.
2019-12-26 22:10:19 +05:30
2020-06-23 00:09:42 +05:30
We are discussing [automating this entire process](https://gitlab.com/gitlab-org/gitlab/-/issues/19896).
2018-12-05 23:21:45 +05:30
## Recreate the merge request
2020-04-22 19:07:51 +05:30
CrowdIn creates a new merge request as soon as the old one is closed
2021-02-22 17:27:13 +05:30
or merged. But it does not recreate the `master-i18n` branch every
2020-04-22 19:07:51 +05:30
time. To force CrowdIn to recreate the branch, close any [open merge
2020-03-13 15:44:24 +05:30
request](https://gitlab.com/gitlab-org/gitlab/-/merge_requests?scope=all&utf8=%E2%9C%93&state=opened&author_username=gitlab-crowdin-bot)
2018-12-05 23:21:45 +05:30
and delete the
2019-12-21 20:55:43 +05:30
[`master-18n`](https://gitlab.com/gitlab-org/gitlab/-/branches/all?utf8=✓&search=master-i18n).
2018-12-05 23:21:45 +05:30
This might be needed when the merge request contains failures that
2021-04-29 21:17:54 +05:30
have been fixed on the default branch.
2020-06-23 00:09:42 +05:30
## Recreate the GitLab integration in CrowdIn
2021-02-22 17:27:13 +05:30
NOTE:
2020-06-23 00:09:42 +05:30
These instructions work only for GitLab Team Members.
2021-03-11 19:13:27 +05:30
If for some reason the GitLab integration in CrowdIn doesn't exist, you can
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).)
1. Sign in to CrowdIn with the GitLab integration.
1. Go to **Settings > Integrations > GitLab > Set Up Integration**.
1. Select the `gitlab-org/gitlab` repository.
1. In `Select Branches for Translation`, select `master`.
1. Ensure the `Service Branch Name` is `master-i18n`.
2021-06-08 01:23:25 +05:30
## Manually update the translation levels
There's no automated way to pull the translation levels from CrowdIn, to display
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.