... |
... |
@@ -1,4 +1,13 @@ |
1 |
1 |
{{velocity}} |
|
2 |
+## If the translation key exists, use its value, otherwise use to the provided fallback value. |
|
3 |
+#macro (translateOrElse $translationKey $fallback) |
|
4 |
+ #if($services.localization.get($translationKey)) |
|
5 |
+ $services.rendering.escape($services.localization.render($translationKey), 'xwiki/2.1')## |
|
6 |
+ #else |
|
7 |
+ $fallback## |
|
8 |
+ #end |
|
9 |
+#end |
|
10 |
+ |
2 |
2 |
## Find all wiki macros sp that we can find if a registered macro is a wiki macro |
3 |
3 |
#set ($wikiMacroDocuments = $services.query.xwql("from doc.object(XWiki.WikiMacroClass) as macros").execute()) |
4 |
4 |
#set ($wikiMacroMap = {}) |
... |
... |
@@ -7,17 +7,25 @@ |
7 |
7 |
#set ($macroObject = $macroDocument.getObject("XWiki.WikiMacroClass")) |
8 |
8 |
#set ($discard = $wikiMacroMap.put($macroObject.id, [$macroDocument.documentReference.toString(), $macroObject.visibility])) |
9 |
9 |
#end |
10 |
|
-|=$services.localization.render('help.macroList.id')|=$services.localization.render('help.macroList.name')|=$services.localization.render('help.macroList.category')|=$services.localization.render('help.macroList.description')|=$services.localization.render('help.macroList.visibility') |
|
19 |
+|={{translation key='help.macroList.id'/}}|={{translation key='help.macroList.name'/}}|={{translation key='help.macroList.categories'/}}|={{translation key='help.macroList.description'/}}|={{translation key='help.macroList.visibility'/}} |
11 |
11 |
#foreach ($descriptor in $services.rendering.getMacroDescriptors('xwiki/2.1')) |
12 |
|
- #set ($macroId = $macroDescriptor.id) |
13 |
13 |
#set ($wikiMacroData = $wikiMacroMap.get($descriptor.id.id)) |
14 |
14 |
#if ("$!wikiMacroData" != '') |
15 |
|
- #set ($displayId = "[[$descriptor.id>>$wikiMacroData.get(0)]]") |
|
23 |
+ #set ($displayId = "[[$services.rendering.escape($services.rendering.escape($descriptor.id, 'xwiki/2.1'), 'xwiki/2.1')>>$wikiMacroData.get(0)]]") |
16 |
16 |
#set ($displayVisibility = $wikiMacroData.get(1)) |
17 |
17 |
#else |
18 |
|
- #set ($displayId = $descriptor.id) |
19 |
|
- #set ($displayVisibility = "Global") |
|
26 |
+ #set ($displayId = $services.rendering.escape($descriptor.id, 'xwiki/2.1')) |
|
27 |
+ #set ($displayVisibility = $services.localization.render('XWiki.WikiMacroClass_visibility_Global')) |
20 |
20 |
#end |
21 |
|
- |$displayId|$descriptor.name|$!descriptor.defaultCategory|$descriptor.description|$displayVisibility |
|
29 |
+ |$displayId|## |
|
30 |
+ #translateOrElse("rendering.macro.${descriptor.id.id}.name", $descriptor.name) |
|
31 |
+ |## |
|
32 |
+ #foreach($category in $services.rendering.getMacroCategories($descriptor.id)) |
|
33 |
+ #if($foreach.index>0), #end## |
|
34 |
+ #translateOrElse("rendering.macroCategory.$category", $category) |
|
35 |
+ #end## |
|
36 |
+ |## |
|
37 |
+ #translateOrElse("rendering.macro.${descriptor.id.id}.description", $descriptor.description) |
|
38 |
+ |$services.rendering.escape($displayVisibility, 'xwiki/2.1') |
22 |
22 |
#end |
23 |
23 |
{{/velocity}} |