Translation Macro
Last modified by Thomas Mortagne on 2026/05/19 15:04
| Allow to insert a translation message in a content |
| Type | JAR |
| Category | |
| Developed by | |
| Rating | |
| License | GNU Lesser General Public License 2.1 |
| Bundled With | XWiki Standard |
| Compatibility | since 4.3M2 |
Table of contents
Description
Allow to insert a translation message in a content.
Usage
{{translation key="some.translation" parameters="param1,param2" locale="en_US"/}}Parameters definition
| Name | Optional | Allowed values | Default value | Description |
|---|---|---|---|---|
| key | no | string | The key associated to the translation. | |
| parameters | yes | array | The optional parameter to insert in the translation message if the translation message expect any. | |
| scriptParameters | yes | name of a script variable | XWiki 18.4.0+, 17.10.9+ The name of the variable which contains the list of parameters to pass to the translation. Requires SCRIPT right to be used. | |
| locale | yes | locale | current locale | the language and country in which to translation the provided key |
Example
Example 1:
{{translation key="some.translation"/}}Example 2:
{{translation key="some.translation" parameters="param1,param2"/}}Example 3:
XWiki 18.4.0+, 17.10.9+
{{velocity}}
#set ($txparameters = [$userinput, 42])
{{translation key="some.translation" scriptParameters="txparameters"/}}
{{/velocity}}