This issue has been created
 
 
XWiki Platform / cid:jira-generated-image-avatar-f6e245e9-6301-4602-9f3b-1f88c5afe2a3 XWIKI-24420 Open

Add a velocity helper for the very common use case of a wiki translation macro call with a script parameter

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-0b86f261-2529-47ca-8ae3-e5e89eee4236 Thomas Mortagne created this issue on 27/May/26 11:13
 
Summary: Add a velocity helper for the very common use case of a wiki translation macro call with a script parameter
Issue Type: cid:jira-generated-image-avatar-f6e245e9-6301-4602-9f3b-1f88c5afe2a3 Improvement
Affects Versions: 17.10.8
Assignee: Unassigned
Components: Web - Templates & Resources
Created: 27/May/26 11:13
Priority: cid:jira-generated-image-static-major-b4e381a2-7cd5-494f-8ab2-0fc8cc8c2172 Major
Reporter: Thomas Mortagne
Description:

XWIKI-24290 added the possibility to pass directly a script variable to a translation macro, which makes a lot easier to use user input safely:

{{velocity}}
#set ($txparameters = [$userinput, 42])
{{translation key="some.translation" scriptParameters="txparameters"/}}
{{/velocity}}

But it's a very common use case and a Velocity helper could help make these calls more readable and mitigate the risk of using the same variable for two different calls:

{{velocity}}
#wikiTranslation('some.translation',  [$userinput, 42])
{{/velocity}}