Steps to reproduce
- Install an extension providing a macro whose id contains a hyphen (e.g. the openproject-news macro of the OpenProject Integration), or any macro with an id such as my-macro.
- Edit a dashboard, click "Add gadget" and add that macro.
- Save and view the dashboard.
Expected The gadget title is the translated name of the macro. Actual The gadget title displays the raw macro call, e.g. {{translation key="rendering.macro.openproject-news.name"/}} Cause The gadget wizard (gadgetWizard.js) sets the default title to {{translation key="rendering.macro.<macroId>.name"/}}, but DefaultGadgetSource renders a title with the translation macro only when it matches TRANSLATION_MACRO_PATTERN, whose key part is [a-zA-Z0-9.]+. Keys containing a hyphen (or an underscore), which are valid in macro ids and translation keys, don't match, so the title is rendered as plain text. TRANSLATION_SCRIPT_PATTERN has the same restriction. Suggested fix Accept the characters allowed in translation keys and macro ids (at least - and _) in both patterns. Workaround Edit the gadget and replace its title. |