Code source wiki de ClassTranslationsGenerator

Version 2.1 par Paul Libbrecht (admin) le 2016/07/26 22:02

Afficher les derniers auteurs
1 {{velocity output="false"}}
2 ## Special characters that need to be escaped in the key.
3 #set ($keySpecialCharsPattern = $regextool.compile('([=: \\])'))
4
5 #macro (map $key $value)
6 $keySpecialCharsPattern.matcher($key).replaceAll('\\$1')=$value
7 #end
8 {{/velocity}}
9
10 {{velocity wiki="false"}}
11 $escapetool.h Class fields
12 #set ($prefix = "${doc.fullName}_")
13 #foreach ($property in $doc.getxWikiClass().properties)
14 #map("$prefix$property.name" $property.prettyName)
15 #if ($property.type.endsWith('ListClass'))
16 ## Generate translations for the list values.
17 #foreach ($entry in $property.mapValues.entrySet())
18 #map("$prefix${property.name}_$entry.key" $entry.value.value)
19 #end
20 #end
21 #end
22
23 $escapetool.h Live table generic keys
24 #set ($appName = $doc.name.replaceAll('Class', '').toLowerCase())
25 #set ($prefix = "${appName}.livetable.")
26 #set ($liveTableGenericKeys = {
27 'doc.title': 'liveTableEditorDocTitleColumnName',
28 'doc.name': 'liveTableEditorDocNameColumnName',
29 'doc.space': 'liveTableEditorDocSpaceColumnName',
30 'doc.fullname': 'liveTableEditorDocFullNameColumnName',
31 'doc.author': 'liveTableEditorDocAuthorColumnName',
32 'doc.creator': 'liveTableEditorDocCreatorColumnName',
33 'doc.date': 'liveTableEditorDocDateColumnName',
34 'doc.creationDate': 'liveTableEditorDocCreationDateColumnName',
35 '_avatar': 'liveTableEditorAvatarColumnName',
36 '_images': 'liveTableEditorImagesColumnName',
37 '_attachments': 'liveTableEditorAttachmentsColumnName',
38 '_actions': 'liveTableEditorActionsColumnName',
39 '_actions.edit': 'appLiveTableEditEntryActionName',
40 '_actions.delete': 'appLiveTableDeleteEntryActionName'
41 })
42 #foreach ($entry in $liveTableGenericKeys.entrySet())
43 #map("$prefix$entry.key" $services.localization.render("platform.appwithinminutes.$entry.value"))
44 #end
45 #map("${prefix}emptyvalue" '-')
46
47 $escapetool.h Live table specific keys
48 #foreach ($property in $doc.getxWikiClass().properties)
49 #map("$prefix$property.name" $property.prettyName)
50 #end
51
52 #map("${appName}.dataSpace.title" 'Data')
53 {{/velocity}}
This wiki is licensed under a Creative Commons 2.0 license
XWiki 13.10 - Documentation - Conditions