Project

General

Profile

Patch #43379 » fix-alert-custom-title.patch

Go MAEDA, 2025-10-29 16:48

View differences:

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
(3-3/5)