Changes for page Writing XWiki Rendering Macros in wiki pages
Last modified by Simon Urli on 2023/10/10
Summary
-
Page properties (2 modified, 0 added, 0 removed)
-
Objects (0 modified, 0 added, 1 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. beldaz1 +XWiki.lucaa - Content
-
... ... @@ -30,7 +30,9 @@ 30 30 31 31 Wiki macros are defined using objects of type ##XWiki.WikiMacroClass##. You define a wiki macro by creating a new wiki page and attaching to it an object of type ##XWiki.WikiMacroClass##. 32 32 33 -{{warning}}There can be only one object of type ##XWiki.WikiMacroClass## per wiki page (if you add more only the first will be used).{{/warning}} 33 +{{warning}} 34 +There can be only one object of type ##XWiki.WikiMacroClass## per wiki page (if you add more only the first will be used). 35 +{{/warning}} 34 34 35 35 36 36 This class contains the following fields: ... ... @@ -92,6 +92,29 @@ 92 92 {{hello greetUser="true"/}} 93 93 {{/code}} 94 94 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 + 95 95 = WYSIWYG Access = 96 96 97 97 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: ... ... @@ -117,7 +117,7 @@ 117 117 #end 118 118 ## 119 119 ## Rest of the code. 120 -{{velocity}} 145 +{{/velocity}} 121 121 {{/code}} 122 122 123 123 = Scripting Tips =
- XWiki.XWikiComments[3]
-
- Author
-
... ... @@ -1,1 +1,0 @@ 1 -xwiki:XWiki.beldaz - Comment
-
... ... @@ -1,1 +1,0 @@ 1 -What is the purpose of the Macro Content? Could an example be included? - Date
-
... ... @@ -1,1 +1,0 @@ 1 -2014-10-03 21:45:12.672