Externalize CI job failure messages for translation

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

CommitStatusPresenter::CALLOUT_FAILURE_MESSAGES (53 strings) and Gitlab::Ci::Status::Build::Failed::REASONS (54 strings) are English literals in frozen constants. Neither appears in locale/gitlab.pot, so the job page failure callout and the job status tooltip are never translated. Ci::JobEntity serializes the callout and the job page renders it raw, so nothing translates it on the frontend either.

The tooltip shows the gap plainly: REASONS is interpolated into s_('CiStatusLabel|Failed'), so a German user gets Fehlgeschlagen - (unknown failure).

🛠️ with ❤️ at Siemens

Improvements

Job failure text follows the user's locale, like the rest of the job page.

One question first: is English-only deliberate for job failure reasons? If it is, close this and we will document the exception instead.

Risks

  • Wrapping the literals where they are does not work. _() in a constant runs once at class load and freezes the default locale, and Cop/StaticTranslationDefinition fails the pipeline for it. Both classes already expose self.callout_failure_messages and self.reasons, so the strings move into those methods.
  • Nothing matches on the text. Both hashes are read for display only, keyed by failure reason.
  • Regenerating the POT adds one entry per message and no behavior change. Measured for the presenter half: 54 new msgids, locale/gitlab.pot +162 lines.
  • The hashes gain entries most months, e.g. !250214 (merged). Keep this to one merge request and merge it quickly, or expect conflicts.

Involved components

  • app/presenters/commit_status_presenter.rb
  • lib/gitlab/ci/status/build/failed.rb
  • locale/gitlab.pot

Optional: Missing test coverage

spec/presenters/commit_status_presenter_spec.rb and spec/lib/gitlab/ci/status/build/failed_spec.rb assert the English text. Per the i18n guide they should assert against the helper instead.

References

Edited by 🤖 GitLab Bot 🤖