Skip to content

Enforce use of `safe_format` for externalized strings

Problem

In https://docs.gitlab.com/ee/development/i18n/externalization.html#html we suggest to use

  safe_format(_('Some %{strongOpen}bold%{strongClose} text.'),  strongOpen: '<strong>'.html_safe, strongClose: '</strong>'.html_safe)

Using .html_safe inappropriately can lead to subtle bugs like #374074 (closed).

Proposed

Enforce the use safe_format for externalized strings in HAML.

Discussions

!98179 (comment 1103291059)

Edited by Peter Leitzen