Wiki源代码ClassTranslationsGenerator
由 xu yang 于 2021/11/29 03:09 最后修改
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
| |
1.1 | 1 | {{include reference="AppWithinMinutes.VelocityMacros" /}} |
| 2 | |||
| 3 | {{velocity output="false"}} | ||
| 4 | ## Special characters that need to be escaped in the key. | ||
| 5 | #set ($keySpecialCharsPattern = $regextool.compile('([=: \\])')) | ||
| 6 | |||
| 7 | #macro (map $key $value) | ||
| 8 | $keySpecialCharsPattern.matcher($key).replaceAll('\\$1')=$value | ||
| 9 | #end | ||
| 10 | |||
| 11 | #getAppTitle | ||
| 12 | {{/velocity}} | ||
| 13 | |||
| 14 | {{velocity wiki="false"}} | ||
| 15 | $escapetool.h Class fields | ||
| 16 | #set ($prefix = "${doc.fullName}_") | ||
| 17 | #foreach ($property in $doc.getxWikiClass().properties) | ||
| 18 | #map("$prefix$property.name" $property.prettyName) | ||
| 19 | #if ($property.type == 'StaticListClass') | ||
| 20 | ## Generate translations for the list values. | ||
| 21 | #foreach ($entry in $property.mapValues.entrySet()) | ||
| 22 | #map("$prefix${property.name}_$entry.key" $entry.value.value) | ||
| 23 | #end | ||
| 24 | #end | ||
| 25 | #end | ||
| 26 | |||
| 27 | $escapetool.h Sheet keys | ||
| 28 | #set ($appName = $doc.documentReference.name.replaceAll('Class', '').toLowerCase()) | ||
| 29 | #map("${appName}.sheet.description" "This page controls how $appTitle pages are displayed in both view and edit modes.") | ||
| 30 | #map("${appName}.sheet.noObject" "The current page doesn't have the expected $appTitle object.") | ||
| 31 | #map("${appName}.sheet.noFields" "The $appTitle application doesn't have any fields to display.") | ||
| 32 | |||
| 33 | $escapetool.h Live table generic keys | ||
| 34 | #set ($prefix = "${appName}.livetable.") | ||
| 35 | #set ($liveTableGenericKeys = { | ||
| 36 | 'doc.title': 'liveTableEditorDocTitleColumnName', | ||
| 37 | 'doc.name': 'liveTableEditorDocNameColumnName', | ||
| 38 | 'doc.space': 'liveTableEditorDocSpaceColumnName', | ||
| 39 | 'doc.fullname': 'liveTableEditorDocFullNameColumnName', | ||
| 40 | 'doc.location': 'liveTableEditorDocLocationColumnName', | ||
| 41 | 'doc.author': 'liveTableEditorDocAuthorColumnName', | ||
| 42 | 'doc.creator': 'liveTableEditorDocCreatorColumnName', | ||
| 43 | 'doc.date': 'liveTableEditorDocDateColumnName', | ||
| 44 | 'doc.creationDate': 'liveTableEditorDocCreationDateColumnName', | ||
| 45 | '_avatar': 'liveTableEditorAvatarColumnName', | ||
| 46 | '_images': 'liveTableEditorImagesColumnName', | ||
| 47 | '_attachments': 'liveTableEditorAttachmentsColumnName', | ||
| 48 | '_actions': 'liveTableEditorActionsColumnName', | ||
| 49 | '_actions.edit': 'appLiveTableEditEntryActionName', | ||
| 50 | '_actions.delete': 'appLiveTableDeleteEntryActionName' | ||
| 51 | }) | ||
| 52 | #foreach ($entry in $liveTableGenericKeys.entrySet()) | ||
| 53 | #map("$prefix$entry.key" $services.localization.render("platform.appwithinminutes.$entry.value")) | ||
| 54 | #end | ||
| 55 | #map("${prefix}emptyvalue" '-') | ||
| 56 | |||
| 57 | $escapetool.h Live table specific keys | ||
| 58 | #foreach ($property in $doc.getxWikiClass().properties) | ||
| 59 | #map("$prefix$property.name" $property.prettyName) | ||
| 60 | #end | ||
| 61 | |||
| 62 | $escapetool.h Other keys | ||
| 63 | #map("${appName}.entry.name" $appTitle) | ||
| 64 | |||
| 65 | $escapetool.h Deprecated keys | ||
| 66 | #map("${appName}.dataSpace.title" 'Data') | ||
| 67 | {{/velocity}} |