Changes for page Writing XWiki Rendering Macros in wiki pages
Last modified by Clément Desableau on 2023/06/01
Change comment:
Added section about the translations for the macro
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. ThomasMortagne1 +XWiki.lucaa - Content
-
... ... @@ -94,6 +94,29 @@ 94 94 {{hello greetUser="true"/}} 95 95 {{/code}} 96 96 97 +== Translations == 98 + 99 +When your macro is ready, you might want to provide the description of the macro and its parameters in different languages. For that, you need to create a set of translation keys and values (as described [[here>>DevGuide.InternationalizingApplications]]) and then just use the following convention for the keys you add in this storage (no modification is needed on the macro itself, the association of the translations to the macro is done based on a convention of the form of the translation keys): 100 + 101 +{{code}} 102 +rendering.macro.<macro id>.name=Name of the macro, displayed in the macros list in the macros wizard 103 +rendering.macro.<macro id>.description=Description of the macro, displayed as a help in the macros list in the macros wizard 104 + 105 +rendering.macro.<macro id>.parameter.<parameter name>.name=Name of the macro parameter, to be displayed in the form for the macro settings in the macros wizard 106 +rendering.macro.<macro id>.parameter.<parameter name>.description=Description of the macro parameter, to be displayed as a help in the form for the macro settings in the macros wizard 107 +{{/code}} 108 + 109 +Don't forget to make sure that the visibility of the translations is the same as the visibility of the macro, so that anywhere you use the macro you also have the translations. 110 + 111 +In our example, french translations would be something like this: 112 + 113 +{{code}} 114 +rendering.macro.hello.name=Macro pour dire bonjour 115 +rendering.macro.hello.description=Ceci est une macro qui va dire "Bonjour" a l'utilisateur 116 +rendering.macro.hello.parameter.greetUser.name=Personnaliser le message 117 +rendering.macro.hello.parameter.greetUser.description=Personnaliser le message pour l'utilisateur courent en train de visualiser la page. Les valeurs possibles sont "true" (oui) et "false" (non). 118 +{{/code}} 119 + 97 97 = WYSIWYG Access = 98 98 99 99 A wiki macros is treated just like any other rendering macro in the system. As such, the moment you save your wiki macro it will be available to the users through the WYSIWYG editor's **Insert Macro** dialog box: