Patch #43379 » fix-alert-custom-title.patch
| lib/redmine/wiki_formatting/common_mark/alerts_icons_filter.rb | ||
|---|---|---|
|
next unless icon_name # Skip if no specific icon is defined for this alert type
|
||
|
# label alert translation
|
||
|
node.content = ::I18n.t("label_alert_#{alert_type}", default: node.content)
|
||
|
label_key = "label_alert_#{alert_type}"
|
||
|
# Only translate if the default title has not been overridden
|
||
|
if node.content == ::I18n.t(label_key, locale: :en)
|
||
|
node.content = ::I18n.t(label_key, default: node.content)
|
||
|
end
|
||
|
icon_html = ApplicationController.helpers.sprite_icon(icon_name, node.text)
|
||
| test/unit/lib/redmine/wiki_formatting/common_mark/alerts_icons_filter_test.rb | ||
|---|---|---|
|
expected = %r{<span class="icon-label">#{I18n.t('label_alert_note')}</span>}
|
||
|
assert_match expected, html
|
||
|
end
|
||
|
def test_should_not_translate_title_if_overridden
|
||
|
set_language_if_valid 'de'
|
||
|
text = <<~MD
|
||
|
> [!note] Custom Note Title
|
||
|
> This is a note.
|
||
|
MD
|
||
|
html = filter(format(text))
|
||
|
assert_match %r{<span class="icon-label">Custom Note Title</span>}, html
|
||
|
end
|
||
|
end
|
||
|
end
|
||