Skip to content

Draft: Update extract_gettext_all to handle escaped characters

Rahul Chanila requested to merge rchanila-master-patch-96161 into master

What does this MR do and why?

Update scripts/frontend/extract_gettext_all.js to handle escaped characters

When using the HTML entity code for angle brackets according to https://docs.gitlab.com/ee/development/i18n/externalization.html#including-angle-brackets the translation file generates the unescaped value which looks like gettext-extractor behavior.

This change reverses this behaviour.


Adds custom form for GAR integration settings (!144704 - merged) adds text GoogleArtifactRegistry|View them in %{strongStart}Deploy > Google Artifact Registry%{strongEnd}.

We get pipeline error: https://gitlab.com/gitlab-org/gitlab/-/jobs/6168126519

**** bin/rake gettext:lint failed with the following error(s):
Linting po files: |============================================================|
Errors in `/builds/gitlab-org/gitlab/locale/gitlab.pot`:
  GoogleArtifactRegistry|View them in %{strongStart}Deploy > Google Artifact Registry%{strongEnd}.
    contains < or >. Use variables to include HTML in the string, or the &lt; and &gt; codes for the symbols. For more info see: https://docs.gitlab.com/ee/development/i18n/externalization.html#html

Updated to use HTML entity codes. Running tooling/bin/gettext_extractor locale/gitlab.pot did not result any change in locale/gitlab.pot file, so it results in the same pipeline error.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

  1. Update any .html.haml file with translation text that contains >
  2. Similarly, update any .vue file with translation text that contains >.
  3. Run tooling/bin/gettext_extractor locale/gitlab.pot. Observe that the locale/gitlab.pot files have the newly added text.
  4. Update the translations to use &gt; instead of >. Re-run tooling/bin/gettext_extractor locale/gitlab.pot.
  5. In locale/gitlab.pot, notice that the text added in the .html.haml file gets updated to use the HTML entity code but the text added in the .vue file still renders >.
  6. Apply this patch.
  7. Re-run tooling/bin/gettext_extractor locale/gitlab.pot. The text added in the .vue file should now be rendered &gt;
Edited by Rahul Chanila

Merge request reports