Commit 78858b611ae58121a4a8c08ade4fc25228a2b4fc
1 parent
3258468e
feat: i18n for editor
Showing
11 changed files
with
244 additions
and
46 deletions
front-end/h5/src/components/core/editor/canvas/edit.js
| @@ -3,26 +3,32 @@ import Shape from '../../support/shape' | @@ -3,26 +3,32 @@ import Shape from '../../support/shape' | ||
| 3 | 3 | ||
| 4 | const contextmenuOptions = [ | 4 | const contextmenuOptions = [ |
| 5 | { | 5 | { |
| 6 | + i18nLabel: 'editor.centerPanel.contextMenu.copy', | ||
| 6 | label: '复制', | 7 | label: '复制', |
| 7 | value: 'copy' | 8 | value: 'copy' |
| 8 | }, | 9 | }, |
| 9 | { | 10 | { |
| 11 | + i18nLabel: 'editor.centerPanel.contextMenu.delete', | ||
| 10 | label: '删除', | 12 | label: '删除', |
| 11 | value: 'delete' | 13 | value: 'delete' |
| 12 | }, | 14 | }, |
| 13 | { | 15 | { |
| 16 | + i18nLabel: 'editor.centerPanel.contextMenu.moveToTop', | ||
| 14 | label: '置顶', | 17 | label: '置顶', |
| 15 | value: 'move2Top' | 18 | value: 'move2Top' |
| 16 | }, | 19 | }, |
| 17 | { | 20 | { |
| 21 | + i18nLabel: 'editor.centerPanel.contextMenu.moveToBottom', | ||
| 18 | label: '置底', | 22 | label: '置底', |
| 19 | value: 'move2Bottom' | 23 | value: 'move2Bottom' |
| 20 | }, | 24 | }, |
| 21 | { | 25 | { |
| 26 | + i18nLabel: 'editor.centerPanel.contextMenu.moveUp', | ||
| 22 | label: '上移', | 27 | label: '上移', |
| 23 | value: 'addZindex' | 28 | value: 'addZindex' |
| 24 | }, | 29 | }, |
| 25 | { | 30 | { |
| 31 | + i18nLabel: 'editor.centerPanel.contextMenu.moveDown', | ||
| 26 | label: '下移', | 32 | label: '下移', |
| 27 | value: 'minusZindex' | 33 | value: 'minusZindex' |
| 28 | } | 34 | } |
| @@ -231,7 +237,7 @@ export default { | @@ -231,7 +237,7 @@ export default { | ||
| 231 | zIndex: 999 | 237 | zIndex: 999 |
| 232 | }} | 238 | }} |
| 233 | > | 239 | > |
| 234 | - { contextmenuOptions.map(option => <a-menu-item key={option.value} data-command={option.value}>{option.label}</a-menu-item>) } | 240 | + { contextmenuOptions.map(option => <a-menu-item key={option.value} data-command={option.value}>{this.$t(option.i18nLabel)}</a-menu-item>) } |
| 235 | </a-menu> | 241 | </a-menu> |
| 236 | : null | 242 | : null |
| 237 | } | 243 | } |
front-end/h5/src/components/core/editor/edit-panel/action.js
| @@ -16,7 +16,7 @@ export default { | @@ -16,7 +16,7 @@ export default { | ||
| 16 | created () {}, | 16 | created () {}, |
| 17 | render (h) { | 17 | render (h) { |
| 18 | const ele = this.editingElement | 18 | const ele = this.editingElement |
| 19 | - if (!ele) return (<span>请先选择一个元素</span>) | 19 | + if (!ele) return (<span>{this.$t('editor.editPanel.common.empty')}</span>) |
| 20 | return (<div> | 20 | return (<div> |
| 21 | TODO | 21 | TODO |
| 22 | </div>) | 22 | </div>) |
front-end/h5/src/components/core/editor/edit-panel/animation.js
| @@ -106,16 +106,17 @@ export default { | @@ -106,16 +106,17 @@ export default { | ||
| 106 | renderAnimationOptions (animationOption) { | 106 | renderAnimationOptions (animationOption) { |
| 107 | return ( | 107 | return ( |
| 108 | <a-form layout="horizontal"> | 108 | <a-form layout="horizontal"> |
| 109 | - <a-form-item label="动画类型" labelCol={{ span: 5 }} wrapperCol={{ span: 16, offset: 2 }}> | 109 | + <a-form-item label={this.$t('editor.editPanel.animation.type')} labelCol={{ span: 5 }} wrapperCol={{ span: 16, offset: 2 }}> |
| 110 | {/* <a-popover placement="left" title="动画列表" trigger="click"> | 110 | {/* <a-popover placement="left" title="动画列表" trigger="click"> |
| 111 | <template slot="content"> | 111 | <template slot="content"> |
| 112 | {this.renderAvaiableAnimations()} | 112 | {this.renderAvaiableAnimations()} |
| 113 | </template> | 113 | </template> |
| 114 | <a-button type="primary">动画列表</a-button> | 114 | <a-button type="primary">动画列表</a-button> |
| 115 | </a-popover> */} | 115 | </a-popover> */} |
| 116 | - <a-button type="link" size="small" icon="ordered-list" onClick={() => { this.drawerVisible = true }}>动画列表</a-button> | 116 | + {/* 动画列表 */} |
| 117 | + <a-button type="link" size="small" icon="ordered-list" onClick={() => { this.drawerVisible = true }}>{this.$t('editor.editPanel.animation.list')}</a-button> | ||
| 117 | </a-form-item> | 118 | </a-form-item> |
| 118 | - <a-form-item label="动画时间" labelCol={{ span: 5 }} wrapperCol={{ span: 16, offset: 2 }} style="margin-bottom:0;"> | 119 | + <a-form-item label={this.$t('editor.editPanel.animation.duration')} labelCol={{ span: 5 }} wrapperCol={{ span: 16, offset: 2 }} style="margin-bottom:0;"> |
| 119 | <a-form-item style={{ display: 'inline-block', width: 'calc(50% - 12px)' }}> | 120 | <a-form-item style={{ display: 'inline-block', width: 'calc(50% - 12px)' }}> |
| 120 | <a-slider | 121 | <a-slider |
| 121 | defaultValue={2} | 122 | defaultValue={2} |
| @@ -132,7 +133,7 @@ export default { | @@ -132,7 +133,7 @@ export default { | ||
| 132 | min={0} | 133 | min={0} |
| 133 | max={20} | 134 | max={20} |
| 134 | size="small" | 135 | size="small" |
| 135 | - formatter={value => `${value}秒`} | 136 | + formatter={value => `${value}秒(s)`} |
| 136 | value={animationOption.duration} | 137 | value={animationOption.duration} |
| 137 | onChange={value => { | 138 | onChange={value => { |
| 138 | animationOption.duration = value | 139 | animationOption.duration = value |
| @@ -140,7 +141,7 @@ export default { | @@ -140,7 +141,7 @@ export default { | ||
| 140 | /> | 141 | /> |
| 141 | </a-form-item> | 142 | </a-form-item> |
| 142 | </a-form-item> | 143 | </a-form-item> |
| 143 | - <a-form-item label="延迟时间" labelCol={{ span: 5 }} wrapperCol={{ span: 16, offset: 2 }} style="margin-bottom:0;"> | 144 | + <a-form-item label={this.$t('editor.editPanel.animation.type')} labelCol={{ span: 5 }} wrapperCol={{ span: 16, offset: 2 }} style="margin-bottom:0;"> |
| 144 | <a-form-item style={{ display: 'inline-block', width: 'calc(50% - 12px)' }}> | 145 | <a-form-item style={{ display: 'inline-block', width: 'calc(50% - 12px)' }}> |
| 145 | <a-slider | 146 | <a-slider |
| 146 | defaultValue={2} | 147 | defaultValue={2} |
| @@ -157,7 +158,7 @@ export default { | @@ -157,7 +158,7 @@ export default { | ||
| 157 | min={0} | 158 | min={0} |
| 158 | max={20} | 159 | max={20} |
| 159 | size="small" | 160 | size="small" |
| 160 | - formatter={value => `${value}秒`} | 161 | + formatter={value => `${value}秒(s)`} |
| 161 | value={animationOption.delay} | 162 | value={animationOption.delay} |
| 162 | onChange={value => { | 163 | onChange={value => { |
| 163 | animationOption.delay = value | 164 | animationOption.delay = value |
| @@ -165,7 +166,7 @@ export default { | @@ -165,7 +166,7 @@ export default { | ||
| 165 | /> | 166 | /> |
| 166 | </a-form-item> | 167 | </a-form-item> |
| 167 | </a-form-item> | 168 | </a-form-item> |
| 168 | - <a-form-item label="运行次数" labelCol={{ span: 5 }} wrapperCol={{ span: 16, offset: 2 }} style="margin-bottom:0;"> | 169 | + <a-form-item label={this.$t('editor.editPanel.animation.iteration')} labelCol={{ span: 5 }} wrapperCol={{ span: 16, offset: 2 }} style="margin-bottom:0;"> |
| 169 | <a-form-item style={{ display: 'inline-block', width: 'calc(50% - 12px)' }}> | 170 | <a-form-item style={{ display: 'inline-block', width: 'calc(50% - 12px)' }}> |
| 170 | <a-slider | 171 | <a-slider |
| 171 | defaultValue={2} | 172 | defaultValue={2} |
| @@ -182,7 +183,7 @@ export default { | @@ -182,7 +183,7 @@ export default { | ||
| 182 | min={0} | 183 | min={0} |
| 183 | max={20} | 184 | max={20} |
| 184 | size="small" | 185 | size="small" |
| 185 | - formatter={value => `${value}次`} | 186 | + formatter={value => `${value}次(times)`} |
| 186 | value={animationOption.interationCount} | 187 | value={animationOption.interationCount} |
| 187 | onChange={value => { | 188 | onChange={value => { |
| 188 | animationOption.interationCount = value | 189 | animationOption.interationCount = value |
| @@ -190,7 +191,7 @@ export default { | @@ -190,7 +191,7 @@ export default { | ||
| 190 | /> | 191 | /> |
| 191 | </a-form-item> | 192 | </a-form-item> |
| 192 | </a-form-item> | 193 | </a-form-item> |
| 193 | - <a-form-item label="循环播放" labelCol={{ span: 5 }} wrapperCol={{ span: 16, offset: 2 }} style="margin-bottom:0;"> | 194 | + <a-form-item label={this.$t('editor.editPanel.animation.inifinite')} labelCol={{ span: 5 }} wrapperCol={{ span: 16, offset: 2 }} style="margin-bottom:0;"> |
| 194 | <a-switch | 195 | <a-switch |
| 195 | value={animationOption.infinite} | 196 | value={animationOption.infinite} |
| 196 | onChange={value => { | 197 | onChange={value => { |
| @@ -204,12 +205,13 @@ export default { | @@ -204,12 +205,13 @@ export default { | ||
| 204 | }, | 205 | }, |
| 205 | render (h) { | 206 | render (h) { |
| 206 | const ele = this.editingElement | 207 | const ele = this.editingElement |
| 207 | - if (!ele) return (<span>请先选择一个元素</span>) | 208 | + if (!ele) return (<span>{this.$t('editor.editPanel.common.empty')}</span>) |
| 208 | return ( | 209 | return ( |
| 209 | <div class="main-animate widget" id="animation-edit-panel"> | 210 | <div class="main-animate widget" id="animation-edit-panel"> |
| 210 | <a-button-group> | 211 | <a-button-group> |
| 211 | - <a-button type="primary" onClick={this.addAnimation}><a-icon type="plus" />添加动画</a-button> | ||
| 212 | - <a-button type="primary" onClick={this.runAnimate}>运行动画<a-icon type="right-circle" /></a-button> | 212 | + {/* 添加动画、运行动画 */} |
| 213 | + <a-button type="primary" onClick={this.addAnimation}><a-icon type="plus" />{this.$t('editor.editPanel.animation.add')}</a-button> | ||
| 214 | + <a-button type="primary" onClick={this.runAnimate}>{this.$t('editor.editPanel.animation.run')}<a-icon type="right-circle" /></a-button> | ||
| 213 | </a-button-group> | 215 | </a-button-group> |
| 214 | { | 216 | { |
| 215 | // Q:这边为何这样写:this.animationQueue.length && ? | 217 | // Q:这边为何这样写:this.animationQueue.length && ? |
| @@ -228,7 +230,9 @@ export default { | @@ -228,7 +230,9 @@ export default { | ||
| 228 | this.animationQueue.map((addedAnimation, index) => ( | 230 | this.animationQueue.map((addedAnimation, index) => ( |
| 229 | <a-collapse-panel key={`${index}`}> | 231 | <a-collapse-panel key={`${index}`}> |
| 230 | <template slot="header"> | 232 | <template slot="header"> |
| 231 | - <span>动画{index + 1}</span> | 233 | + {/* #!zh: 动画{index + 1} */} |
| 234 | + {/* #!en: Animation{index + 1}</span> */} | ||
| 235 | + <span>{this.$t('editor.editPanel.animation.title', { index: index + 1 })}</span> | ||
| 232 | <a-tag color="orange">{animationValue2Name[addedAnimation.type] || addedAnimation.type }</a-tag> | 236 | <a-tag color="orange">{animationValue2Name[addedAnimation.type] || addedAnimation.type }</a-tag> |
| 233 | <a-icon type="delete" onClick={() => this.deleteAnimate(index)} title="删除动画"></a-icon> | 237 | <a-icon type="delete" onClick={() => this.deleteAnimate(index)} title="删除动画"></a-icon> |
| 234 | </template> | 238 | </template> |
front-end/h5/src/components/core/editor/edit-panel/props.js
| @@ -69,7 +69,7 @@ export default { | @@ -69,7 +69,7 @@ export default { | ||
| 69 | }, | 69 | }, |
| 70 | render (h) { | 70 | render (h) { |
| 71 | const ele = this.editingElement | 71 | const ele = this.editingElement |
| 72 | - if (!ele) return (<span>请先选择一个元素</span>) | 72 | + if (!ele) return (<span>{this.$t('editor.editPanel.common.empty')}</span>) |
| 73 | this.mixinEnhancedPropsEditor(ele) | 73 | this.mixinEnhancedPropsEditor(ele) |
| 74 | return this.renderPropsEditorPanel(h, ele) | 74 | return this.renderPropsEditorPanel(h, ele) |
| 75 | } | 75 | } |
front-end/h5/src/components/core/editor/edit-panel/script.js
| @@ -46,7 +46,7 @@ export default { | @@ -46,7 +46,7 @@ export default { | ||
| 46 | }, | 46 | }, |
| 47 | render (h) { | 47 | render (h) { |
| 48 | const ele = this.editingElement | 48 | const ele = this.editingElement |
| 49 | - if (!ele) return (<span>请先选择一个元素</span>) | 49 | + if (!ele) return (<span>{this.$t('editor.editPanel.common.empty')}</span>) |
| 50 | return <div> | 50 | return <div> |
| 51 | <a-button onClick={this.mixinScript} disabled>使用脚本</a-button> | 51 | <a-button onClick={this.mixinScript} disabled>使用脚本</a-button> |
| 52 | <div style={{ margin: '20px' }}></div> | 52 | <div style={{ margin: '20px' }}></div> |
front-end/h5/src/components/core/editor/index.js
| @@ -20,16 +20,19 @@ import LangSelect from '@/components/common/header/LangSelect.vue' | @@ -20,16 +20,19 @@ import LangSelect from '@/components/common/header/LangSelect.vue' | ||
| 20 | 20 | ||
| 21 | const sidebarMenus = [ | 21 | const sidebarMenus = [ |
| 22 | { | 22 | { |
| 23 | + i18nLabel: 'editor.sidebar.components', | ||
| 23 | label: '组件列表', | 24 | label: '组件列表', |
| 24 | value: 'pluginList', | 25 | value: 'pluginList', |
| 25 | antIcon: 'bars' | 26 | antIcon: 'bars' |
| 26 | }, | 27 | }, |
| 27 | { | 28 | { |
| 29 | + i18nLabel: 'editor.sidebar.pages', | ||
| 28 | label: '页面管理', | 30 | label: '页面管理', |
| 29 | value: 'pageManagement', | 31 | value: 'pageManagement', |
| 30 | antIcon: 'snippets' | 32 | antIcon: 'snippets' |
| 31 | }, | 33 | }, |
| 32 | { | 34 | { |
| 35 | + i18nLabel: 'editor.sidebar.templates', | ||
| 33 | label: '免费模板', | 36 | label: '免费模板', |
| 34 | value: 'freeTemplate', | 37 | value: 'freeTemplate', |
| 35 | antIcon: 'appstore' | 38 | antIcon: 'appstore' |
| @@ -38,30 +41,35 @@ const sidebarMenus = [ | @@ -38,30 +41,35 @@ const sidebarMenus = [ | ||
| 38 | 41 | ||
| 39 | const fixedTools = [ | 42 | const fixedTools = [ |
| 40 | { | 43 | { |
| 44 | + i18nTooltip: 'editor.fixedTool.undo', | ||
| 41 | 'tooltip': '撤消', // TODO 支持快捷键 | 45 | 'tooltip': '撤消', // TODO 支持快捷键 |
| 42 | 'text': '撤消', | 46 | 'text': '撤消', |
| 43 | 'icon': 'mail-reply', | 47 | 'icon': 'mail-reply', |
| 44 | 'action': () => undoRedoHistory.undo() | 48 | 'action': () => undoRedoHistory.undo() |
| 45 | }, | 49 | }, |
| 46 | { | 50 | { |
| 51 | + i18nTooltip: 'editor.fixedTool.redo', | ||
| 47 | 'tooltip': '恢复', | 52 | 'tooltip': '恢复', |
| 48 | 'text': '恢复', | 53 | 'text': '恢复', |
| 49 | 'icon': 'mail-forward', | 54 | 'icon': 'mail-forward', |
| 50 | 'action': () => undoRedoHistory.redo() | 55 | 'action': () => undoRedoHistory.redo() |
| 51 | }, | 56 | }, |
| 52 | { | 57 | { |
| 58 | + i18nTooltip: 'editor.fixedTool.preview', | ||
| 53 | 'tooltip': '刷新预览', | 59 | 'tooltip': '刷新预览', |
| 54 | 'text': '刷新预览', | 60 | 'text': '刷新预览', |
| 55 | 'icon': 'eye', | 61 | 'icon': 'eye', |
| 56 | 'action': function () { this.previewVisible = true } | 62 | 'action': function () { this.previewVisible = true } |
| 57 | }, | 63 | }, |
| 58 | { | 64 | { |
| 65 | + i18nTooltip: 'editor.fixedTool.copyCurrentPage', | ||
| 59 | 'tooltip': '复制当前页', | 66 | 'tooltip': '复制当前页', |
| 60 | 'text': '复制当前页', | 67 | 'text': '复制当前页', |
| 61 | 'icon': 'copy', | 68 | 'icon': 'copy', |
| 62 | 'action': function () { this.pageManager({ type: 'copy' }) } | 69 | 'action': function () { this.pageManager({ type: 'copy' }) } |
| 63 | }, | 70 | }, |
| 64 | { | 71 | { |
| 72 | + i18nTooltip: 'editor.fixedTool.importPSD', | ||
| 65 | 'tooltip': '导入PSD', | 73 | 'tooltip': '导入PSD', |
| 66 | 'text': 'Ps', | 74 | 'text': 'Ps', |
| 67 | 'icon': '', | 75 | 'icon': '', |
| @@ -69,12 +77,14 @@ const fixedTools = [ | @@ -69,12 +77,14 @@ const fixedTools = [ | ||
| 69 | 'disabled': true | 77 | 'disabled': true |
| 70 | }, | 78 | }, |
| 71 | { | 79 | { |
| 80 | + i18nTooltip: 'editor.fixedTool.zoomOut', | ||
| 72 | 'tooltip': '放大画布', | 81 | 'tooltip': '放大画布', |
| 73 | 'text': '放大画布', | 82 | 'text': '放大画布', |
| 74 | 'icon': 'plus', | 83 | 'icon': 'plus', |
| 75 | 'action': function () { this.scaleRate += 0.25 } | 84 | 'action': function () { this.scaleRate += 0.25 } |
| 76 | }, | 85 | }, |
| 77 | { | 86 | { |
| 87 | + i18nTooltip: 'editor.fixedTool.zoomIn', | ||
| 78 | 'tooltip': '缩小画布', | 88 | 'tooltip': '缩小画布', |
| 79 | 'text': '缩小画布', | 89 | 'text': '缩小画布', |
| 80 | 'icon': 'minus', | 90 | 'icon': 'minus', |
| @@ -139,15 +149,15 @@ export default { | @@ -139,15 +149,15 @@ export default { | ||
| 139 | return ( | 149 | return ( |
| 140 | this.pages.map((page, index) => ( | 150 | this.pages.map((page, index) => ( |
| 141 | <span style={{ display: 'flex', justifyContent: 'space-between', padding: '12px 0' }}> | 151 | <span style={{ display: 'flex', justifyContent: 'space-between', padding: '12px 0' }}> |
| 142 | - <span>第{index + 1}页</span> | 152 | + {/* #!en: Page<Index> */} |
| 153 | + {/* #!zh: 第<Index>页面 */} | ||
| 154 | + <span>{this.$t('editor.pageManager.title', { index })}</span> | ||
| 143 | <a-dropdown trigger={['hover']} placement='bottomCenter'> | 155 | <a-dropdown trigger={['hover']} placement='bottomCenter'> |
| 144 | - <a class="ant-dropdown-link" href="#"> | ||
| 145 | - <a-icon type="down" /> | ||
| 146 | - </a> | 156 | + <a class="ant-dropdown-link" href="#"><a-icon type="down" /></a> |
| 147 | <a-menu slot="overlay" onClick={({ key }) => { this.pageManager({ type: key }) }}> | 157 | <a-menu slot="overlay" onClick={({ key }) => { this.pageManager({ type: key }) }}> |
| 148 | - <a-menu-item key="add"><a-icon type="user" />新增页面</a-menu-item> | ||
| 149 | - <a-menu-item key="copy"><a-icon type="user" />复制页面</a-menu-item> | ||
| 150 | - <a-menu-item key="delete"><a-icon type="user" />删除页面</a-menu-item> | 158 | + <a-menu-item key="add"><a-icon type="user" />{this.$t('editor.pageManager.actions.add')}</a-menu-item> |
| 159 | + <a-menu-item key="copy"><a-icon type="user" />{this.$t('editor.pageManager.actions.copy')}</a-menu-item> | ||
| 160 | + <a-menu-item key="delete"><a-icon type="user" />{this.$t('editor.pageManager.actions.delete')}</a-menu-item> | ||
| 151 | </a-menu> | 161 | </a-menu> |
| 152 | </a-dropdown> | 162 | </a-dropdown> |
| 153 | </span> | 163 | </span> |
| @@ -163,6 +173,7 @@ export default { | @@ -163,6 +173,7 @@ export default { | ||
| 163 | <a-layout id="luban-editor-layout" style={{ height: '100vh' }}> | 173 | <a-layout id="luban-editor-layout" style={{ height: '100vh' }}> |
| 164 | <a-layout-header class="header"> | 174 | <a-layout-header class="header"> |
| 165 | <LogoOfHeader /> | 175 | <LogoOfHeader /> |
| 176 | + <LangSelect style="float: right;cursor: pointer;" /> | ||
| 166 | {/* TODO we can show the plugins shortcuts here */} | 177 | {/* TODO we can show the plugins shortcuts here */} |
| 167 | <a-menu | 178 | <a-menu |
| 168 | theme="dark" | 179 | theme="dark" |
| @@ -170,12 +181,14 @@ export default { | @@ -170,12 +181,14 @@ export default { | ||
| 170 | defaultSelectedKeys={['2']} | 181 | defaultSelectedKeys={['2']} |
| 171 | style={{ lineHeight: '64px', float: 'right', background: 'transparent' }} | 182 | style={{ lineHeight: '64px', float: 'right', background: 'transparent' }} |
| 172 | > | 183 | > |
| 173 | - <a-menu-item key="1" class="transparent-bg"><a-button type="primary" size="small" onClick={() => { this.previewVisible = true }}>预览</a-button></a-menu-item> | ||
| 174 | - <a-menu-item key="2" class="transparent-bg"><a-button size="small" onClick={() => this.saveWork({ isSaveCover: true })} loading={this.saveWork_loading || this.uploadWorkCover_loading}>保存</a-button></a-menu-item> | 184 | + {/* 保存、预览、发布、设置为模板 */} |
| 185 | + <a-menu-item key="1" class="transparent-bg"><a-button type="primary" size="small" onClick={() => { this.previewVisible = true }}>{this.$t('editor.header.preview')}</a-button></a-menu-item> | ||
| 186 | + <a-menu-item key="2" class="transparent-bg"><a-button size="small" onClick={() => this.saveWork({ isSaveCover: true })} loading={this.saveWork_loading || this.uploadWorkCover_loading}>{this.$t('editor.header.save')}</a-button></a-menu-item> | ||
| 175 | {/* <a-menu-item key="3" class="transparent-bg"><a-button size="small">发布</a-button></a-menu-item> */} | 187 | {/* <a-menu-item key="3" class="transparent-bg"><a-button size="small">发布</a-button></a-menu-item> */} |
| 176 | <a-menu-item key="3" class="transparent-bg"> | 188 | <a-menu-item key="3" class="transparent-bg"> |
| 177 | <a-dropdown-button onClick={() => {}} size="small"> | 189 | <a-dropdown-button onClick={() => {}} size="small"> |
| 178 | - 发布 | 190 | + {/* 发布 */} |
| 191 | + {this.$t('editor.header.publish')} | ||
| 179 | <a-menu slot="overlay" onClick={({ key }) => { | 192 | <a-menu slot="overlay" onClick={({ key }) => { |
| 180 | switch (key) { | 193 | switch (key) { |
| 181 | case 'setAsTemplate': | 194 | case 'setAsTemplate': |
| @@ -187,7 +200,8 @@ export default { | @@ -187,7 +200,8 @@ export default { | ||
| 187 | }}> | 200 | }}> |
| 188 | <a-menu-item key="setAsTemplate"> | 201 | <a-menu-item key="setAsTemplate"> |
| 189 | <a-spin spinning={this.setWorkAsTemplate_loading} size="small"> | 202 | <a-spin spinning={this.setWorkAsTemplate_loading} size="small"> |
| 190 | - <a-icon type="cloud-upload" />设置为模板 | 203 | + {/* 设置为模板 */} |
| 204 | + <a-icon type="cloud-upload" />{this.$t('editor.header.setAsTemplate')} | ||
| 191 | </a-spin> | 205 | </a-spin> |
| 192 | </a-menu-item> | 206 | </a-menu-item> |
| 193 | {/* <a-menu-item key="2"><a-icon type="user" />2nd menu item</a-menu-item> */} | 207 | {/* <a-menu-item key="2"><a-icon type="user" />2nd menu item</a-menu-item> */} |
| @@ -197,7 +211,6 @@ export default { | @@ -197,7 +211,6 @@ export default { | ||
| 197 | </a-menu-item> | 211 | </a-menu-item> |
| 198 | </a-menu> | 212 | </a-menu> |
| 199 | <ExternalLinksOfHeader /> | 213 | <ExternalLinksOfHeader /> |
| 200 | - <LangSelect /> | ||
| 201 | </a-layout-header> | 214 | </a-layout-header> |
| 202 | <a-layout> | 215 | <a-layout> |
| 203 | <a-layout-sider width="160" style="background: #fff" collapsed> | 216 | <a-layout-sider width="160" style="background: #fff" collapsed> |
| @@ -211,7 +224,8 @@ export default { | @@ -211,7 +224,8 @@ export default { | ||
| 211 | sidebarMenus.map(menu => ( | 224 | sidebarMenus.map(menu => ( |
| 212 | <a-menu-item key={menu.value}> | 225 | <a-menu-item key={menu.value}> |
| 213 | <a-icon type={menu.antIcon} /> | 226 | <a-icon type={menu.antIcon} /> |
| 214 | - <span>{menu.label}</span> | 227 | + {/* <span>{menu.label}</span> */} |
| 228 | + <span>{this.$t(menu.i18nLabel)}</span> | ||
| 215 | </a-menu-item> | 229 | </a-menu-item> |
| 216 | )) | 230 | )) |
| 217 | } | 231 | } |
| @@ -234,8 +248,9 @@ export default { | @@ -234,8 +248,9 @@ export default { | ||
| 234 | } | 248 | } |
| 235 | }} | 249 | }} |
| 236 | > | 250 | > |
| 237 | - <a-radio-button label={false} value={false}>编辑模式</a-radio-button> | ||
| 238 | - <a-radio-button label={true} value={true}>预览模式</a-radio-button> | 251 | + {/* 编辑模式、预览模式 */} |
| 252 | + <a-radio-button label={false} value={false}>{this.$t('editor.centerPanel.mode.edit')}</a-radio-button> | ||
| 253 | + <a-radio-button label={true} value={true}>{this.$t('editor.centerPanel.mode.preview')}</a-radio-button> | ||
| 239 | </a-radio-group> | 254 | </a-radio-group> |
| 240 | </div> | 255 | </div> |
| 241 | <div class='canvas-wrapper' style={{ transform: `scale(${this.scaleRate})` }}> | 256 | <div class='canvas-wrapper' style={{ transform: `scale(${this.scaleRate})` }}> |
| @@ -256,7 +271,8 @@ export default { | @@ -256,7 +271,8 @@ export default { | ||
| 256 | <a-button-group style={{ display: 'flex', flexDirection: 'column' }}> | 271 | <a-button-group style={{ display: 'flex', flexDirection: 'column' }}> |
| 257 | { | 272 | { |
| 258 | fixedTools.map(tool => ( | 273 | fixedTools.map(tool => ( |
| 259 | - <a-tooltip effect="dark" placement="left" title={tool.tooltip}> | 274 | + // <a-tooltip effect="dark" placement="left" title={tool.tooltip}> |
| 275 | + <a-tooltip effect="dark" placement="left" title={this.$t(tool.i18nTooltip)}> | ||
| 260 | <a-button block class="transparent-bg" type="link" size="small" style={{ height: '40px', color: '#000' }} onClick={() => tool.action && tool.action.call(this) } disabled={!!tool.disabled}> | 276 | <a-button block class="transparent-bg" type="link" size="small" style={{ height: '40px', color: '#000' }} onClick={() => tool.action && tool.action.call(this) } disabled={!!tool.disabled}> |
| 261 | { tool.icon ? <i class={['shortcut-icon', 'fa', `fa-${tool.icon}`]} aria-hidden='true'/> : tool.text } | 277 | { tool.icon ? <i class={['shortcut-icon', 'fa', `fa-${tool.icon}`]} aria-hidden='true'/> : tool.text } |
| 262 | </a-button> | 278 | </a-button> |
| @@ -278,17 +294,10 @@ export default { | @@ -278,17 +294,10 @@ export default { | ||
| 278 | ElementUI:label | 294 | ElementUI:label |
| 279 | Ant Design Vue:tab | 295 | Ant Design Vue:tab |
| 280 | */} | 296 | */} |
| 281 | - <a-tab-pane key="属性"> | ||
| 282 | - <span slot="tab"> | ||
| 283 | - <a-icon type="apple" /> | ||
| 284 | - 属性 | ||
| 285 | - </span> | ||
| 286 | - {/* { this.renderPropsEditorPanel(h) } */} | ||
| 287 | - <RenderPropsEditor/> | ||
| 288 | - </a-tab-pane> | ||
| 289 | - <a-tab-pane label="动画" key='动画' tab='动画'><RenderAnimationEditor /></a-tab-pane> | ||
| 290 | - <a-tab-pane label="动作" key='动作' tab='动作'>{this.activeTabKey === '动作'}{ this.activeTabKey === '动作' && <RenderActoionEditor/> }</a-tab-pane> | ||
| 291 | - <a-tab-pane label="脚本" key='脚本' tab='脚本'><RenderScriptEditor/></a-tab-pane> | 297 | + <a-tab-pane key="属性"><span slot="tab"><a-icon type="apple" />{this.$t('editor.editPanel.tab.prop')}</span><RenderPropsEditor/></a-tab-pane> |
| 298 | + <a-tab-pane label="动画" key='动画' tab={this.$t('editor.editPanel.tab.animation')}><RenderAnimationEditor /></a-tab-pane> | ||
| 299 | + <a-tab-pane label="动作" key='动作' tab={this.$t('editor.editPanel.tab.action')}>{ this.activeTabKey === '动作' && <RenderActoionEditor/> }</a-tab-pane> | ||
| 300 | + <a-tab-pane label="脚本" key='脚本' tab={this.$t('editor.editPanel.tab.script')}><RenderScriptEditor/></a-tab-pane> | ||
| 292 | </a-tabs> | 301 | </a-tabs> |
| 293 | </a-layout-sider> | 302 | </a-layout-sider> |
| 294 | 303 |
front-end/h5/src/components/core/editor/shortcuts-panel/index.js
| 1 | import ShortcutButton from './shortcut-button' | 1 | import ShortcutButton from './shortcut-button' |
| 2 | +import langMixin from '@/mixins/i18n' | ||
| 2 | export default { | 3 | export default { |
| 4 | + mixins: [langMixin], | ||
| 3 | props: { | 5 | props: { |
| 4 | pluginsList: { | 6 | pluginsList: { |
| 5 | required: false, | 7 | required: false, |
| @@ -91,7 +93,8 @@ export default { | @@ -91,7 +93,8 @@ export default { | ||
| 91 | <a-col span={12} style={{ marginTop: '10px' }}> | 93 | <a-col span={12} style={{ marginTop: '10px' }}> |
| 92 | <ShortcutButton | 94 | <ShortcutButton |
| 93 | clickFn={this.onClickShortcut.bind(this, plugin)} | 95 | clickFn={this.onClickShortcut.bind(this, plugin)} |
| 94 | - title={plugin.title} | 96 | + // title={plugin.title} |
| 97 | + title={plugin.i18nTitle[this.currentLang] || plugin.title} | ||
| 95 | faIcon={plugin.icon} | 98 | faIcon={plugin.icon} |
| 96 | disabled={plugin.disabled} | 99 | disabled={plugin.disabled} |
| 97 | /> | 100 | /> |
front-end/h5/src/locales/lang/en-US.js
| @@ -26,5 +26,72 @@ export default { | @@ -26,5 +26,72 @@ export default { | ||
| 26 | }, | 26 | }, |
| 27 | basicData: { | 27 | basicData: { |
| 28 | viewData: 'View Data' | 28 | viewData: 'View Data' |
| 29 | + }, | ||
| 30 | + editor: { | ||
| 31 | + sidebar: { | ||
| 32 | + components: 'Components', | ||
| 33 | + pages: 'Pages', | ||
| 34 | + templates: 'Templates' | ||
| 35 | + }, | ||
| 36 | + pageManager: { | ||
| 37 | + title: 'Page {index}', | ||
| 38 | + action: { | ||
| 39 | + add: 'Add Page', | ||
| 40 | + copy: 'Copy Page', | ||
| 41 | + delete: 'Delete Page' | ||
| 42 | + } | ||
| 43 | + }, | ||
| 44 | + header: { | ||
| 45 | + preview: 'Preview', | ||
| 46 | + save: 'Save', | ||
| 47 | + publish: 'Publish', | ||
| 48 | + setAsTemplate: 'Set As Template' | ||
| 49 | + }, | ||
| 50 | + | ||
| 51 | + centerPanel: { | ||
| 52 | + mode: { | ||
| 53 | + edit: 'Edit', | ||
| 54 | + preview: 'Preview' | ||
| 55 | + }, | ||
| 56 | + contextMenu: { | ||
| 57 | + copy: 'Copy', | ||
| 58 | + delete: 'Delete', | ||
| 59 | + moveToTop: 'Move To Top', | ||
| 60 | + moveToBottom: 'Move To Bottom', | ||
| 61 | + moveUp: 'Move Up', | ||
| 62 | + moveDown: 'Move Down' | ||
| 63 | + } | ||
| 64 | + }, | ||
| 65 | + fixedTool: { | ||
| 66 | + undo: 'Undo', | ||
| 67 | + redo: 'Redo', | ||
| 68 | + preview: 'Preview', | ||
| 69 | + copyCurrentPage: 'CopyCurrentPage', | ||
| 70 | + importPSD: 'Import PSD', | ||
| 71 | + zoomIn: 'Zoom In', | ||
| 72 | + zoomOut: 'Zoom Out' | ||
| 73 | + }, | ||
| 74 | + editPanel: { | ||
| 75 | + tab: { | ||
| 76 | + prop: 'Prop', | ||
| 77 | + animation: 'Animation', | ||
| 78 | + action: 'Action', | ||
| 79 | + script: 'Script' | ||
| 80 | + }, | ||
| 81 | + animation: { | ||
| 82 | + add: 'Add', | ||
| 83 | + run: 'Run', | ||
| 84 | + type: 'Type', | ||
| 85 | + duration: 'Duration', | ||
| 86 | + delay: 'Delay', | ||
| 87 | + iteration: 'Iteration', | ||
| 88 | + inifinite: 'Inifinite', | ||
| 89 | + list: 'Select Animation', | ||
| 90 | + title: 'Animation {index}' | ||
| 91 | + }, | ||
| 92 | + common: { | ||
| 93 | + empty: 'Select an element first please!' | ||
| 94 | + } | ||
| 95 | + } | ||
| 29 | } | 96 | } |
| 30 | } | 97 | } |
front-end/h5/src/locales/lang/zh-CN.js
| 1 | export default { | 1 | export default { |
| 2 | + app: { | ||
| 3 | + title: '鲁班 H5' | ||
| 4 | + }, | ||
| 2 | header: { | 5 | header: { |
| 3 | chineseDocument: '中文文档', | 6 | chineseDocument: '中文文档', |
| 4 | englishDocument: '英文文档', | 7 | englishDocument: '英文文档', |
| @@ -23,5 +26,71 @@ export default { | @@ -23,5 +26,71 @@ export default { | ||
| 23 | }, | 26 | }, |
| 24 | basicData: { | 27 | basicData: { |
| 25 | viewData: 'View Data' | 28 | viewData: 'View Data' |
| 29 | + }, | ||
| 30 | + editor: { | ||
| 31 | + sidebar: { | ||
| 32 | + components: '组件列表', | ||
| 33 | + pages: '页面管理', | ||
| 34 | + templates: '模板' | ||
| 35 | + }, | ||
| 36 | + pageManager: { | ||
| 37 | + title: '第{index}页面', | ||
| 38 | + action: { | ||
| 39 | + add: '新增页面', | ||
| 40 | + copy: '复制页面', | ||
| 41 | + delete: '删除页面' | ||
| 42 | + } | ||
| 43 | + }, | ||
| 44 | + header: { | ||
| 45 | + preview: '预览', | ||
| 46 | + save: '保存', | ||
| 47 | + publish: '发布', | ||
| 48 | + setAsTemplate: '设置为模板' | ||
| 49 | + }, | ||
| 50 | + centerPanel: { | ||
| 51 | + mode: { | ||
| 52 | + edit: 'Edit', | ||
| 53 | + preview: 'Preview' | ||
| 54 | + }, | ||
| 55 | + contextMenu: { | ||
| 56 | + copy: '复制', | ||
| 57 | + delete: '删除', | ||
| 58 | + moveToTop: '置顶', | ||
| 59 | + moveToBottom: '置底', | ||
| 60 | + moveUp: '上移', | ||
| 61 | + moveDown: '下移' | ||
| 62 | + } | ||
| 63 | + }, | ||
| 64 | + fixedTool: { | ||
| 65 | + undo: '撤销', | ||
| 66 | + redo: '重做', | ||
| 67 | + preview: '预览', | ||
| 68 | + copyCurrentPage: '复制当前页面', | ||
| 69 | + importPSD: '导入PSD', | ||
| 70 | + zoomIn: '缩小', | ||
| 71 | + zoomOut: '放大' | ||
| 72 | + }, | ||
| 73 | + editPanel: { | ||
| 74 | + tab: { | ||
| 75 | + prop: '属性', | ||
| 76 | + animation: '动画', | ||
| 77 | + action: '动作', | ||
| 78 | + script: '脚本' | ||
| 79 | + }, | ||
| 80 | + animation: { | ||
| 81 | + add: '添加动画', | ||
| 82 | + run: '运行动画', | ||
| 83 | + type: '动画类型', | ||
| 84 | + duration: '动画时长', | ||
| 85 | + delay: '动画延时', | ||
| 86 | + iteration: '运行次数', | ||
| 87 | + inifinite: '循环播放', | ||
| 88 | + list: '选择动画', | ||
| 89 | + title: 'Animation {index}' | ||
| 90 | + }, | ||
| 91 | + common: { | ||
| 92 | + empty: 'Select an element first please!' | ||
| 93 | + } | ||
| 94 | + } | ||
| 26 | } | 95 | } |
| 27 | } | 96 | } |
front-end/h5/src/mixins/load-plugins.js
| @@ -9,12 +9,20 @@ import LbpFormRadioGroup from '../components/plugins/lbp-form-radio-group' | @@ -9,12 +9,20 @@ import LbpFormRadioGroup from '../components/plugins/lbp-form-radio-group' | ||
| 9 | export const pluginsList = [ | 9 | export const pluginsList = [ |
| 10 | { | 10 | { |
| 11 | title: '图片', | 11 | title: '图片', |
| 12 | + i18nTitle: { | ||
| 13 | + 'en-US': 'Picture', | ||
| 14 | + 'zh-CN': '图片' | ||
| 15 | + }, | ||
| 12 | icon: 'photo', | 16 | icon: 'photo', |
| 13 | component: LbpPicture, | 17 | component: LbpPicture, |
| 14 | visible: true, | 18 | visible: true, |
| 15 | name: LbpPicture.name | 19 | name: LbpPicture.name |
| 16 | }, | 20 | }, |
| 17 | { | 21 | { |
| 22 | + i18nTitle: { | ||
| 23 | + 'en-US': 'Text', | ||
| 24 | + 'zh-CN': '文字' | ||
| 25 | + }, | ||
| 18 | title: '文字', | 26 | title: '文字', |
| 19 | icon: 'text-width', | 27 | icon: 'text-width', |
| 20 | component: LbpText, | 28 | component: LbpText, |
| @@ -22,6 +30,10 @@ export const pluginsList = [ | @@ -22,6 +30,10 @@ export const pluginsList = [ | ||
| 22 | name: LbpText.name | 30 | name: LbpText.name |
| 23 | }, | 31 | }, |
| 24 | { | 32 | { |
| 33 | + i18nTitle: { | ||
| 34 | + 'en-US': 'Button', | ||
| 35 | + 'zh-CN': '普通按钮' | ||
| 36 | + }, | ||
| 25 | title: '普通按钮', | 37 | title: '普通按钮', |
| 26 | icon: 'hand-pointer-o', | 38 | icon: 'hand-pointer-o', |
| 27 | component: LbpButton, | 39 | component: LbpButton, |
| @@ -29,6 +41,10 @@ export const pluginsList = [ | @@ -29,6 +41,10 @@ export const pluginsList = [ | ||
| 29 | name: LbpButton.name | 41 | name: LbpButton.name |
| 30 | }, | 42 | }, |
| 31 | { | 43 | { |
| 44 | + i18nTitle: { | ||
| 45 | + 'en-US': 'Carousel', | ||
| 46 | + 'zh-CN': '轮播图' | ||
| 47 | + }, | ||
| 32 | title: '轮播图', | 48 | title: '轮播图', |
| 33 | icon: 'photo', | 49 | icon: 'photo', |
| 34 | component: LbpFormRadioGroup, | 50 | component: LbpFormRadioGroup, |
| @@ -37,6 +53,10 @@ export const pluginsList = [ | @@ -37,6 +53,10 @@ export const pluginsList = [ | ||
| 37 | disabled: true | 53 | disabled: true |
| 38 | }, | 54 | }, |
| 39 | { | 55 | { |
| 56 | + i18nTitle: { | ||
| 57 | + 'en-US': 'Map', | ||
| 58 | + 'zh-CN': '地图' | ||
| 59 | + }, | ||
| 40 | title: '地图', | 60 | title: '地图', |
| 41 | icon: 'map-o', | 61 | icon: 'map-o', |
| 42 | component: LbpFormRadioGroup, | 62 | component: LbpFormRadioGroup, |
| @@ -45,6 +65,10 @@ export const pluginsList = [ | @@ -45,6 +65,10 @@ export const pluginsList = [ | ||
| 45 | disabled: true | 65 | disabled: true |
| 46 | }, | 66 | }, |
| 47 | { | 67 | { |
| 68 | + i18nTitle: { | ||
| 69 | + 'en-US': 'Video', | ||
| 70 | + 'zh-CN': '视频' | ||
| 71 | + }, | ||
| 48 | title: '视频', | 72 | title: '视频', |
| 49 | icon: 'file-video-o', | 73 | icon: 'file-video-o', |
| 50 | component: LbpFormRadioGroup, | 74 | component: LbpFormRadioGroup, |
| @@ -60,6 +84,10 @@ export const pluginsList = [ | @@ -60,6 +84,10 @@ export const pluginsList = [ | ||
| 60 | // name: LbpVideo.name | 84 | // name: LbpVideo.name |
| 61 | // }, | 85 | // }, |
| 62 | { | 86 | { |
| 87 | + i18nTitle: { | ||
| 88 | + 'en-US': 'Form Input', | ||
| 89 | + 'zh-CN': '表单输入' | ||
| 90 | + }, | ||
| 63 | title: '表单输入', | 91 | title: '表单输入', |
| 64 | icon: 'pencil-square-o', | 92 | icon: 'pencil-square-o', |
| 65 | component: LbpFormInput, | 93 | component: LbpFormInput, |
| @@ -67,6 +95,10 @@ export const pluginsList = [ | @@ -67,6 +95,10 @@ export const pluginsList = [ | ||
| 67 | name: LbpFormInput.name | 95 | name: LbpFormInput.name |
| 68 | }, | 96 | }, |
| 69 | { | 97 | { |
| 98 | + i18nTitle: { | ||
| 99 | + 'en-US': 'Form Submit', | ||
| 100 | + 'zh-CN': '表单提交' | ||
| 101 | + }, | ||
| 70 | title: '表单提交', | 102 | title: '表单提交', |
| 71 | icon: 'hand-pointer-o', | 103 | icon: 'hand-pointer-o', |
| 72 | component: LbpFormButton, | 104 | component: LbpFormButton, |
| @@ -81,6 +113,10 @@ export const pluginsList = [ | @@ -81,6 +113,10 @@ export const pluginsList = [ | ||
| 81 | // name: LbpFormRadio.name | 113 | // name: LbpFormRadio.name |
| 82 | // }, | 114 | // }, |
| 83 | { | 115 | { |
| 116 | + i18nTitle: { | ||
| 117 | + 'en-US': 'Form Checkbox', | ||
| 118 | + 'zh-CN': '表单多选' | ||
| 119 | + }, | ||
| 84 | title: '表单单选', | 120 | title: '表单单选', |
| 85 | icon: 'check-square-o', | 121 | icon: 'check-square-o', |
| 86 | component: LbpFormRadioGroup, | 122 | component: LbpFormRadioGroup, |
| @@ -88,6 +124,10 @@ export const pluginsList = [ | @@ -88,6 +124,10 @@ export const pluginsList = [ | ||
| 88 | name: LbpFormRadioGroup.name | 124 | name: LbpFormRadioGroup.name |
| 89 | }, | 125 | }, |
| 90 | { | 126 | { |
| 127 | + i18nTitle: { | ||
| 128 | + 'en-US': 'Form Radio', | ||
| 129 | + 'zh-CN': '表单单选' | ||
| 130 | + }, | ||
| 91 | title: '表单单选', | 131 | title: '表单单选', |
| 92 | icon: 'dot-circle-o', | 132 | icon: 'dot-circle-o', |
| 93 | component: LbpFormRadioGroup, | 133 | component: LbpFormRadioGroup, |
front-end/h5/src/views/work-manager/index.vue
| @@ -99,7 +99,7 @@ export default { | @@ -99,7 +99,7 @@ export default { | ||
| 99 | <a-layout id="luban-work-manager-layout" style={{ height: '100vh' }}> | 99 | <a-layout id="luban-work-manager-layout" style={{ height: '100vh' }}> |
| 100 | <a-layout-header class="header"> | 100 | <a-layout-header class="header"> |
| 101 | <LogoOfHeader /> | 101 | <LogoOfHeader /> |
| 102 | - <LangSelect /> | 102 | + <LangSelect style="float: right;cursor: pointer;" /> |
| 103 | {/* TODO we can show the plugins shortcuts here */} | 103 | {/* TODO we can show the plugins shortcuts here */} |
| 104 | <a-dropdown> | 104 | <a-dropdown> |
| 105 | <a-menu slot="overlay" onClick={() => {}}> | 105 | <a-menu slot="overlay" onClick={() => {}}> |