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 | 3 | |
| 4 | 4 | const contextmenuOptions = [ |
| 5 | 5 | { |
| 6 | + i18nLabel: 'editor.centerPanel.contextMenu.copy', | |
| 6 | 7 | label: '复制', |
| 7 | 8 | value: 'copy' |
| 8 | 9 | }, |
| 9 | 10 | { |
| 11 | + i18nLabel: 'editor.centerPanel.contextMenu.delete', | |
| 10 | 12 | label: '删除', |
| 11 | 13 | value: 'delete' |
| 12 | 14 | }, |
| 13 | 15 | { |
| 16 | + i18nLabel: 'editor.centerPanel.contextMenu.moveToTop', | |
| 14 | 17 | label: '置顶', |
| 15 | 18 | value: 'move2Top' |
| 16 | 19 | }, |
| 17 | 20 | { |
| 21 | + i18nLabel: 'editor.centerPanel.contextMenu.moveToBottom', | |
| 18 | 22 | label: '置底', |
| 19 | 23 | value: 'move2Bottom' |
| 20 | 24 | }, |
| 21 | 25 | { |
| 26 | + i18nLabel: 'editor.centerPanel.contextMenu.moveUp', | |
| 22 | 27 | label: '上移', |
| 23 | 28 | value: 'addZindex' |
| 24 | 29 | }, |
| 25 | 30 | { |
| 31 | + i18nLabel: 'editor.centerPanel.contextMenu.moveDown', | |
| 26 | 32 | label: '下移', |
| 27 | 33 | value: 'minusZindex' |
| 28 | 34 | } |
| ... | ... | @@ -231,7 +237,7 @@ export default { |
| 231 | 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 | 241 | </a-menu> |
| 236 | 242 | : null |
| 237 | 243 | } | ... | ... |
front-end/h5/src/components/core/editor/edit-panel/action.js
front-end/h5/src/components/core/editor/edit-panel/animation.js
| ... | ... | @@ -106,16 +106,17 @@ export default { |
| 106 | 106 | renderAnimationOptions (animationOption) { |
| 107 | 107 | return ( |
| 108 | 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 | 110 | {/* <a-popover placement="left" title="动画列表" trigger="click"> |
| 111 | 111 | <template slot="content"> |
| 112 | 112 | {this.renderAvaiableAnimations()} |
| 113 | 113 | </template> |
| 114 | 114 | <a-button type="primary">动画列表</a-button> |
| 115 | 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 | 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 | 120 | <a-form-item style={{ display: 'inline-block', width: 'calc(50% - 12px)' }}> |
| 120 | 121 | <a-slider |
| 121 | 122 | defaultValue={2} |
| ... | ... | @@ -132,7 +133,7 @@ export default { |
| 132 | 133 | min={0} |
| 133 | 134 | max={20} |
| 134 | 135 | size="small" |
| 135 | - formatter={value => `${value}秒`} | |
| 136 | + formatter={value => `${value}秒(s)`} | |
| 136 | 137 | value={animationOption.duration} |
| 137 | 138 | onChange={value => { |
| 138 | 139 | animationOption.duration = value |
| ... | ... | @@ -140,7 +141,7 @@ export default { |
| 140 | 141 | /> |
| 141 | 142 | </a-form-item> |
| 142 | 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 | 145 | <a-form-item style={{ display: 'inline-block', width: 'calc(50% - 12px)' }}> |
| 145 | 146 | <a-slider |
| 146 | 147 | defaultValue={2} |
| ... | ... | @@ -157,7 +158,7 @@ export default { |
| 157 | 158 | min={0} |
| 158 | 159 | max={20} |
| 159 | 160 | size="small" |
| 160 | - formatter={value => `${value}秒`} | |
| 161 | + formatter={value => `${value}秒(s)`} | |
| 161 | 162 | value={animationOption.delay} |
| 162 | 163 | onChange={value => { |
| 163 | 164 | animationOption.delay = value |
| ... | ... | @@ -165,7 +166,7 @@ export default { |
| 165 | 166 | /> |
| 166 | 167 | </a-form-item> |
| 167 | 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 | 170 | <a-form-item style={{ display: 'inline-block', width: 'calc(50% - 12px)' }}> |
| 170 | 171 | <a-slider |
| 171 | 172 | defaultValue={2} |
| ... | ... | @@ -182,7 +183,7 @@ export default { |
| 182 | 183 | min={0} |
| 183 | 184 | max={20} |
| 184 | 185 | size="small" |
| 185 | - formatter={value => `${value}次`} | |
| 186 | + formatter={value => `${value}次(times)`} | |
| 186 | 187 | value={animationOption.interationCount} |
| 187 | 188 | onChange={value => { |
| 188 | 189 | animationOption.interationCount = value |
| ... | ... | @@ -190,7 +191,7 @@ export default { |
| 190 | 191 | /> |
| 191 | 192 | </a-form-item> |
| 192 | 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 | 195 | <a-switch |
| 195 | 196 | value={animationOption.infinite} |
| 196 | 197 | onChange={value => { |
| ... | ... | @@ -204,12 +205,13 @@ export default { |
| 204 | 205 | }, |
| 205 | 206 | render (h) { |
| 206 | 207 | const ele = this.editingElement |
| 207 | - if (!ele) return (<span>请先选择一个元素</span>) | |
| 208 | + if (!ele) return (<span>{this.$t('editor.editPanel.common.empty')}</span>) | |
| 208 | 209 | return ( |
| 209 | 210 | <div class="main-animate widget" id="animation-edit-panel"> |
| 210 | 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 | 215 | </a-button-group> |
| 214 | 216 | { |
| 215 | 217 | // Q:这边为何这样写:this.animationQueue.length && ? |
| ... | ... | @@ -228,7 +230,9 @@ export default { |
| 228 | 230 | this.animationQueue.map((addedAnimation, index) => ( |
| 229 | 231 | <a-collapse-panel key={`${index}`}> |
| 230 | 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 | 236 | <a-tag color="orange">{animationValue2Name[addedAnimation.type] || addedAnimation.type }</a-tag> |
| 233 | 237 | <a-icon type="delete" onClick={() => this.deleteAnimate(index)} title="删除动画"></a-icon> |
| 234 | 238 | </template> | ... | ... |
front-end/h5/src/components/core/editor/edit-panel/props.js
| ... | ... | @@ -69,7 +69,7 @@ export default { |
| 69 | 69 | }, |
| 70 | 70 | render (h) { |
| 71 | 71 | const ele = this.editingElement |
| 72 | - if (!ele) return (<span>请先选择一个元素</span>) | |
| 72 | + if (!ele) return (<span>{this.$t('editor.editPanel.common.empty')}</span>) | |
| 73 | 73 | this.mixinEnhancedPropsEditor(ele) |
| 74 | 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 | 46 | }, |
| 47 | 47 | render (h) { |
| 48 | 48 | const ele = this.editingElement |
| 49 | - if (!ele) return (<span>请先选择一个元素</span>) | |
| 49 | + if (!ele) return (<span>{this.$t('editor.editPanel.common.empty')}</span>) | |
| 50 | 50 | return <div> |
| 51 | 51 | <a-button onClick={this.mixinScript} disabled>使用脚本</a-button> |
| 52 | 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 | 20 | |
| 21 | 21 | const sidebarMenus = [ |
| 22 | 22 | { |
| 23 | + i18nLabel: 'editor.sidebar.components', | |
| 23 | 24 | label: '组件列表', |
| 24 | 25 | value: 'pluginList', |
| 25 | 26 | antIcon: 'bars' |
| 26 | 27 | }, |
| 27 | 28 | { |
| 29 | + i18nLabel: 'editor.sidebar.pages', | |
| 28 | 30 | label: '页面管理', |
| 29 | 31 | value: 'pageManagement', |
| 30 | 32 | antIcon: 'snippets' |
| 31 | 33 | }, |
| 32 | 34 | { |
| 35 | + i18nLabel: 'editor.sidebar.templates', | |
| 33 | 36 | label: '免费模板', |
| 34 | 37 | value: 'freeTemplate', |
| 35 | 38 | antIcon: 'appstore' |
| ... | ... | @@ -38,30 +41,35 @@ const sidebarMenus = [ |
| 38 | 41 | |
| 39 | 42 | const fixedTools = [ |
| 40 | 43 | { |
| 44 | + i18nTooltip: 'editor.fixedTool.undo', | |
| 41 | 45 | 'tooltip': '撤消', // TODO 支持快捷键 |
| 42 | 46 | 'text': '撤消', |
| 43 | 47 | 'icon': 'mail-reply', |
| 44 | 48 | 'action': () => undoRedoHistory.undo() |
| 45 | 49 | }, |
| 46 | 50 | { |
| 51 | + i18nTooltip: 'editor.fixedTool.redo', | |
| 47 | 52 | 'tooltip': '恢复', |
| 48 | 53 | 'text': '恢复', |
| 49 | 54 | 'icon': 'mail-forward', |
| 50 | 55 | 'action': () => undoRedoHistory.redo() |
| 51 | 56 | }, |
| 52 | 57 | { |
| 58 | + i18nTooltip: 'editor.fixedTool.preview', | |
| 53 | 59 | 'tooltip': '刷新预览', |
| 54 | 60 | 'text': '刷新预览', |
| 55 | 61 | 'icon': 'eye', |
| 56 | 62 | 'action': function () { this.previewVisible = true } |
| 57 | 63 | }, |
| 58 | 64 | { |
| 65 | + i18nTooltip: 'editor.fixedTool.copyCurrentPage', | |
| 59 | 66 | 'tooltip': '复制当前页', |
| 60 | 67 | 'text': '复制当前页', |
| 61 | 68 | 'icon': 'copy', |
| 62 | 69 | 'action': function () { this.pageManager({ type: 'copy' }) } |
| 63 | 70 | }, |
| 64 | 71 | { |
| 72 | + i18nTooltip: 'editor.fixedTool.importPSD', | |
| 65 | 73 | 'tooltip': '导入PSD', |
| 66 | 74 | 'text': 'Ps', |
| 67 | 75 | 'icon': '', |
| ... | ... | @@ -69,12 +77,14 @@ const fixedTools = [ |
| 69 | 77 | 'disabled': true |
| 70 | 78 | }, |
| 71 | 79 | { |
| 80 | + i18nTooltip: 'editor.fixedTool.zoomOut', | |
| 72 | 81 | 'tooltip': '放大画布', |
| 73 | 82 | 'text': '放大画布', |
| 74 | 83 | 'icon': 'plus', |
| 75 | 84 | 'action': function () { this.scaleRate += 0.25 } |
| 76 | 85 | }, |
| 77 | 86 | { |
| 87 | + i18nTooltip: 'editor.fixedTool.zoomIn', | |
| 78 | 88 | 'tooltip': '缩小画布', |
| 79 | 89 | 'text': '缩小画布', |
| 80 | 90 | 'icon': 'minus', |
| ... | ... | @@ -139,15 +149,15 @@ export default { |
| 139 | 149 | return ( |
| 140 | 150 | this.pages.map((page, index) => ( |
| 141 | 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 | 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 | 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 | 161 | </a-menu> |
| 152 | 162 | </a-dropdown> |
| 153 | 163 | </span> |
| ... | ... | @@ -163,6 +173,7 @@ export default { |
| 163 | 173 | <a-layout id="luban-editor-layout" style={{ height: '100vh' }}> |
| 164 | 174 | <a-layout-header class="header"> |
| 165 | 175 | <LogoOfHeader /> |
| 176 | + <LangSelect style="float: right;cursor: pointer;" /> | |
| 166 | 177 | {/* TODO we can show the plugins shortcuts here */} |
| 167 | 178 | <a-menu |
| 168 | 179 | theme="dark" |
| ... | ... | @@ -170,12 +181,14 @@ export default { |
| 170 | 181 | defaultSelectedKeys={['2']} |
| 171 | 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 | 187 | {/* <a-menu-item key="3" class="transparent-bg"><a-button size="small">发布</a-button></a-menu-item> */} |
| 176 | 188 | <a-menu-item key="3" class="transparent-bg"> |
| 177 | 189 | <a-dropdown-button onClick={() => {}} size="small"> |
| 178 | - 发布 | |
| 190 | + {/* 发布 */} | |
| 191 | + {this.$t('editor.header.publish')} | |
| 179 | 192 | <a-menu slot="overlay" onClick={({ key }) => { |
| 180 | 193 | switch (key) { |
| 181 | 194 | case 'setAsTemplate': |
| ... | ... | @@ -187,7 +200,8 @@ export default { |
| 187 | 200 | }}> |
| 188 | 201 | <a-menu-item key="setAsTemplate"> |
| 189 | 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 | 205 | </a-spin> |
| 192 | 206 | </a-menu-item> |
| 193 | 207 | {/* <a-menu-item key="2"><a-icon type="user" />2nd menu item</a-menu-item> */} |
| ... | ... | @@ -197,7 +211,6 @@ export default { |
| 197 | 211 | </a-menu-item> |
| 198 | 212 | </a-menu> |
| 199 | 213 | <ExternalLinksOfHeader /> |
| 200 | - <LangSelect /> | |
| 201 | 214 | </a-layout-header> |
| 202 | 215 | <a-layout> |
| 203 | 216 | <a-layout-sider width="160" style="background: #fff" collapsed> |
| ... | ... | @@ -211,7 +224,8 @@ export default { |
| 211 | 224 | sidebarMenus.map(menu => ( |
| 212 | 225 | <a-menu-item key={menu.value}> |
| 213 | 226 | <a-icon type={menu.antIcon} /> |
| 214 | - <span>{menu.label}</span> | |
| 227 | + {/* <span>{menu.label}</span> */} | |
| 228 | + <span>{this.$t(menu.i18nLabel)}</span> | |
| 215 | 229 | </a-menu-item> |
| 216 | 230 | )) |
| 217 | 231 | } |
| ... | ... | @@ -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 | 254 | </a-radio-group> |
| 240 | 255 | </div> |
| 241 | 256 | <div class='canvas-wrapper' style={{ transform: `scale(${this.scaleRate})` }}> |
| ... | ... | @@ -256,7 +271,8 @@ export default { |
| 256 | 271 | <a-button-group style={{ display: 'flex', flexDirection: 'column' }}> |
| 257 | 272 | { |
| 258 | 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 | 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 | 277 | { tool.icon ? <i class={['shortcut-icon', 'fa', `fa-${tool.icon}`]} aria-hidden='true'/> : tool.text } |
| 262 | 278 | </a-button> |
| ... | ... | @@ -278,17 +294,10 @@ export default { |
| 278 | 294 | ElementUI:label |
| 279 | 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 | 301 | </a-tabs> |
| 293 | 302 | </a-layout-sider> |
| 294 | 303 | ... | ... |
front-end/h5/src/components/core/editor/shortcuts-panel/index.js
| 1 | 1 | import ShortcutButton from './shortcut-button' |
| 2 | +import langMixin from '@/mixins/i18n' | |
| 2 | 3 | export default { |
| 4 | + mixins: [langMixin], | |
| 3 | 5 | props: { |
| 4 | 6 | pluginsList: { |
| 5 | 7 | required: false, |
| ... | ... | @@ -91,7 +93,8 @@ export default { |
| 91 | 93 | <a-col span={12} style={{ marginTop: '10px' }}> |
| 92 | 94 | <ShortcutButton |
| 93 | 95 | clickFn={this.onClickShortcut.bind(this, plugin)} |
| 94 | - title={plugin.title} | |
| 96 | + // title={plugin.title} | |
| 97 | + title={plugin.i18nTitle[this.currentLang] || plugin.title} | |
| 95 | 98 | faIcon={plugin.icon} |
| 96 | 99 | disabled={plugin.disabled} |
| 97 | 100 | /> | ... | ... |
front-end/h5/src/locales/lang/en-US.js
| ... | ... | @@ -26,5 +26,72 @@ export default { |
| 26 | 26 | }, |
| 27 | 27 | basicData: { |
| 28 | 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 | 1 | export default { |
| 2 | + app: { | |
| 3 | + title: '鲁班 H5' | |
| 4 | + }, | |
| 2 | 5 | header: { |
| 3 | 6 | chineseDocument: '中文文档', |
| 4 | 7 | englishDocument: '英文文档', |
| ... | ... | @@ -23,5 +26,71 @@ export default { |
| 23 | 26 | }, |
| 24 | 27 | basicData: { |
| 25 | 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 | 9 | export const pluginsList = [ |
| 10 | 10 | { |
| 11 | 11 | title: '图片', |
| 12 | + i18nTitle: { | |
| 13 | + 'en-US': 'Picture', | |
| 14 | + 'zh-CN': '图片' | |
| 15 | + }, | |
| 12 | 16 | icon: 'photo', |
| 13 | 17 | component: LbpPicture, |
| 14 | 18 | visible: true, |
| 15 | 19 | name: LbpPicture.name |
| 16 | 20 | }, |
| 17 | 21 | { |
| 22 | + i18nTitle: { | |
| 23 | + 'en-US': 'Text', | |
| 24 | + 'zh-CN': '文字' | |
| 25 | + }, | |
| 18 | 26 | title: '文字', |
| 19 | 27 | icon: 'text-width', |
| 20 | 28 | component: LbpText, |
| ... | ... | @@ -22,6 +30,10 @@ export const pluginsList = [ |
| 22 | 30 | name: LbpText.name |
| 23 | 31 | }, |
| 24 | 32 | { |
| 33 | + i18nTitle: { | |
| 34 | + 'en-US': 'Button', | |
| 35 | + 'zh-CN': '普通按钮' | |
| 36 | + }, | |
| 25 | 37 | title: '普通按钮', |
| 26 | 38 | icon: 'hand-pointer-o', |
| 27 | 39 | component: LbpButton, |
| ... | ... | @@ -29,6 +41,10 @@ export const pluginsList = [ |
| 29 | 41 | name: LbpButton.name |
| 30 | 42 | }, |
| 31 | 43 | { |
| 44 | + i18nTitle: { | |
| 45 | + 'en-US': 'Carousel', | |
| 46 | + 'zh-CN': '轮播图' | |
| 47 | + }, | |
| 32 | 48 | title: '轮播图', |
| 33 | 49 | icon: 'photo', |
| 34 | 50 | component: LbpFormRadioGroup, |
| ... | ... | @@ -37,6 +53,10 @@ export const pluginsList = [ |
| 37 | 53 | disabled: true |
| 38 | 54 | }, |
| 39 | 55 | { |
| 56 | + i18nTitle: { | |
| 57 | + 'en-US': 'Map', | |
| 58 | + 'zh-CN': '地图' | |
| 59 | + }, | |
| 40 | 60 | title: '地图', |
| 41 | 61 | icon: 'map-o', |
| 42 | 62 | component: LbpFormRadioGroup, |
| ... | ... | @@ -45,6 +65,10 @@ export const pluginsList = [ |
| 45 | 65 | disabled: true |
| 46 | 66 | }, |
| 47 | 67 | { |
| 68 | + i18nTitle: { | |
| 69 | + 'en-US': 'Video', | |
| 70 | + 'zh-CN': '视频' | |
| 71 | + }, | |
| 48 | 72 | title: '视频', |
| 49 | 73 | icon: 'file-video-o', |
| 50 | 74 | component: LbpFormRadioGroup, |
| ... | ... | @@ -60,6 +84,10 @@ export const pluginsList = [ |
| 60 | 84 | // name: LbpVideo.name |
| 61 | 85 | // }, |
| 62 | 86 | { |
| 87 | + i18nTitle: { | |
| 88 | + 'en-US': 'Form Input', | |
| 89 | + 'zh-CN': '表单输入' | |
| 90 | + }, | |
| 63 | 91 | title: '表单输入', |
| 64 | 92 | icon: 'pencil-square-o', |
| 65 | 93 | component: LbpFormInput, |
| ... | ... | @@ -67,6 +95,10 @@ export const pluginsList = [ |
| 67 | 95 | name: LbpFormInput.name |
| 68 | 96 | }, |
| 69 | 97 | { |
| 98 | + i18nTitle: { | |
| 99 | + 'en-US': 'Form Submit', | |
| 100 | + 'zh-CN': '表单提交' | |
| 101 | + }, | |
| 70 | 102 | title: '表单提交', |
| 71 | 103 | icon: 'hand-pointer-o', |
| 72 | 104 | component: LbpFormButton, |
| ... | ... | @@ -81,6 +113,10 @@ export const pluginsList = [ |
| 81 | 113 | // name: LbpFormRadio.name |
| 82 | 114 | // }, |
| 83 | 115 | { |
| 116 | + i18nTitle: { | |
| 117 | + 'en-US': 'Form Checkbox', | |
| 118 | + 'zh-CN': '表单多选' | |
| 119 | + }, | |
| 84 | 120 | title: '表单单选', |
| 85 | 121 | icon: 'check-square-o', |
| 86 | 122 | component: LbpFormRadioGroup, |
| ... | ... | @@ -88,6 +124,10 @@ export const pluginsList = [ |
| 88 | 124 | name: LbpFormRadioGroup.name |
| 89 | 125 | }, |
| 90 | 126 | { |
| 127 | + i18nTitle: { | |
| 128 | + 'en-US': 'Form Radio', | |
| 129 | + 'zh-CN': '表单单选' | |
| 130 | + }, | |
| 91 | 131 | title: '表单单选', |
| 92 | 132 | icon: 'dot-circle-o', |
| 93 | 133 | component: LbpFormRadioGroup, | ... | ... |
front-end/h5/src/views/work-manager/index.vue
| ... | ... | @@ -99,7 +99,7 @@ export default { |
| 99 | 99 | <a-layout id="luban-work-manager-layout" style={{ height: '100vh' }}> |
| 100 | 100 | <a-layout-header class="header"> |
| 101 | 101 | <LogoOfHeader /> |
| 102 | - <LangSelect /> | |
| 102 | + <LangSelect style="float: right;cursor: pointer;" /> | |
| 103 | 103 | {/* TODO we can show the plugins shortcuts here */} |
| 104 | 104 | <a-dropdown> |
| 105 | 105 | <a-menu slot="overlay" onClick={() => {}}> | ... | ... |