Wiki source code of ClassTranslationsGenerator
Version 1.1 by superadmin on 2018/07/31 17:43
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
| |
1.1 | 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 == 'StaticListClass') | ||
| 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.location': 'liveTableEditorDocLocationColumnName', | ||
| 32 | 'doc.author': 'liveTableEditorDocAuthorColumnName', | ||
| 33 | 'doc.creator': 'liveTableEditorDocCreatorColumnName', | ||
| 34 | 'doc.date': 'liveTableEditorDocDateColumnName', | ||
| 35 | 'doc.creationDate': 'liveTableEditorDocCreationDateColumnName', | ||
| 36 | '_avatar': 'liveTableEditorAvatarColumnName', | ||
| 37 | '_images': 'liveTableEditorImagesColumnName', | ||
| 38 | '_attachments': 'liveTableEditorAttachmentsColumnName', | ||
| 39 | '_actions': 'liveTableEditorActionsColumnName', | ||
| 40 | '_actions.edit': 'appLiveTableEditEntryActionName', | ||
| 41 | '_actions.delete': 'appLiveTableDeleteEntryActionName' | ||
| 42 | }) | ||
| 43 | #foreach ($entry in $liveTableGenericKeys.entrySet()) | ||
| 44 | #map("$prefix$entry.key" $services.localization.render("platform.appwithinminutes.$entry.value")) | ||
| 45 | #end | ||
| 46 | #map("${prefix}emptyvalue" '-') | ||
| 47 | |||
| 48 | $escapetool.h Live table specific keys | ||
| 49 | #foreach ($property in $doc.getxWikiClass().properties) | ||
| 50 | #map("$prefix$property.name" $property.prettyName) | ||
| 51 | #end | ||
| 52 | |||
| 53 | $escapetool.h Other keys | ||
| 54 | #map("${appName}.entry.name" $stringtool.removeEnd($doc.name, 'Class')) | ||
| 55 | |||
| 56 | $escapetool.h Deprecated keys | ||
| 57 | #map("${appName}.dataSpace.title" 'Data') | ||
| 58 | {{/velocity}} |