Context
Users look for a macro with the word they have in mind, which is often not its exact name: “callout” or “note” for a message box, “latex” or “formula” for MathJax, “columns” for Container, “subpages” for Children, “carousel” for Gallery. Quick Actions and the Insert Macro dialog only match the identifier, the name and the description of a macro, so these words give no result, and users can conclude that XWiki has no such macro. Today, /latex lists Template, and /equation and /callout list nothing. See XWIKI-25444.
Adding the synonyms to the descriptions would make them match “as expected”, but the descriptions would get longer and less useful as a summary of what the macro does.
Proposal
Let a macro declare search keywords, translatable like its name and description:
- Declared through a new
rendering.macro.<id>.keywordstranslation key, holding a comma separated list, e.g.rendering.macro.mathjax.keywords=latex, equation, formula, math.
It sits next to the existing.nameand.descriptionkeys, so Java macros declare it in theirApplicationResourcesand wiki macros in a translation document, and each language gets its own words. - The macro keywords are never displayed to the end user (except in the doc maybe).
- This proposal is just for the mechanism, not the exact values we want for each macro.
No change to the rendering API is needed. The other option would be a keywords field on MacroDescriptor in xwiki-rendering, used as the untranslated default, like the name and description. I’d keep it for later, if extensions ask for it.
Opinion
+1 for these new translation keys and their use in the macro pickers/filters because:
- This implementation reuses a structure every macro already follows for its name and description.
- Keywords are very related to the language, so they belong in the translations, and translators can add the synonyms people really use in their language.
- It’s cheap and safe: a macro without the key behaves exactly as today.
Conclusion
- Do you agree to let macros declare search keywords with a
rendering.macro.<id>.keywordstranslation key? - Do you agree to match them in both Quick Actions and the Insert Macro dialog? Is there any other place where it should be used?
Thank you in advance for sharing your opinion!
Lucas C.