Wiki源代码ClassTranslationsGenerator
在2022-05-25 17:59上被ybq sz修改
Show last authors
| 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 Live table generic keys |
| 28 | #set ($appName = $doc.documentReference.name.replaceAll('Class', '').toLowerCase()) |
| 29 | #set ($prefix = "${appName}.livetable.") |
| 30 | #set ($liveTableGenericKeys = { |
| 31 | 'doc.title': 'liveTableEditorDocTitleColumnName', |
| 32 | 'doc.name': 'liveTableEditorDocNameColumnName', |
| 33 | 'doc.space': 'liveTableEditorDocSpaceColumnName', |
| 34 | 'doc.fullname': 'liveTableEditorDocFullNameColumnName', |
| 35 | 'doc.location': 'liveTableEditorDocLocationColumnName', |
| 36 | 'doc.author': 'liveTableEditorDocAuthorColumnName', |
| 37 | 'doc.creator': 'liveTableEditorDocCreatorColumnName', |
| 38 | 'doc.date': 'liveTableEditorDocDateColumnName', |
| 39 | 'doc.creationDate': 'liveTableEditorDocCreationDateColumnName', |
| 40 | '_avatar': 'liveTableEditorAvatarColumnName', |
| 41 | '_images': 'liveTableEditorImagesColumnName', |
| 42 | '_attachments': 'liveTableEditorAttachmentsColumnName', |
| 43 | '_actions': 'liveTableEditorActionsColumnName', |
| 44 | '_actions.edit': 'appLiveTableEditEntryActionName', |
| 45 | '_actions.delete': 'appLiveTableDeleteEntryActionName' |
| 46 | }) |
| 47 | #foreach ($entry in $liveTableGenericKeys.entrySet()) |
| 48 | #map("$prefix$entry.key" $services.localization.render("platform.appwithinminutes.$entry.value")) |
| 49 | #end |
| 50 | #map("${prefix}emptyvalue" '-') |
| 51 | |
| 52 | $escapetool.h Live table specific keys |
| 53 | #foreach ($property in $doc.getxWikiClass().properties) |
| 54 | #map("$prefix$property.name" $property.prettyName) |
| 55 | #end |
| 56 | |
| 57 | $escapetool.h Other keys |
| 58 | #map("${appName}.entry.name" $appTitle) |
| 59 | |
| 60 | $escapetool.h Deprecated keys |
| 61 | #map("${appName}.dataSpace.title" 'Data') |
| 62 | {{/velocity}} |