Skip to content

Add multilanguage #150

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
236 changes: 118 additions & 118 deletions src/components/SimpleProcessDesignerV2/src/consts.ts

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -4,110 +4,72 @@
<slot name="control-header"></slot>
<template v-if="!$slots['control-header']">
<ElButtonGroup key="file-control">
<XButton preIcon="ep:folder-opened" title="打开文件" @click="refFile.click()" />
<XButton preIcon="ep:folder-opened" :title="$t('bpm.design.openFile')" @click="refFile.click()" />
<el-tooltip effect="light" placement="bottom">
<template #content>
<div style="color: #409eff">
<!-- <el-button link @click="downloadProcessAsXml()">下载为XML文件</el-button> -->
<XTextButton title="下载为XML文件" @click="downloadProcessAsXml()" />
<XTextButton :title="$t('bpm.design.downloadXml')" @click="downloadProcessAsXml()" />
<br />

<!-- <el-button link @click="downloadProcessAsSvg()">下载为SVG文件</el-button> -->
<XTextButton title="下载为SVG文件" @click="downloadProcessAsSvg()" />
<XTextButton :title="$t('bpm.design.downloadSvg')" @click="downloadProcessAsSvg()" />
<br />

<!-- <el-button link @click="downloadProcessAsBpmn()">下载为BPMN文件</el-button> -->
<XTextButton title="下载为BPMN文件" @click="downloadProcessAsBpmn()" />
<XTextButton :title="$t('bpm.design.downloadBpmn')" @click="downloadProcessAsBpmn()" />
</div>
</template>
<XButton title="下载文件" preIcon="ep:download" />
<XButton :title="$t('bpm.design.downloadFile')" preIcon="ep:download" />
</el-tooltip>
<el-tooltip effect="light">
<XButton preIcon="ep:view" title="浏览" />
<XButton preIcon="ep:view" :title="$t('bpm.design.preview')" />
<template #content>
<!-- <el-button link @click="previewProcessXML">预览XML</el-button> -->
<XTextButton title="预览XML" @click="previewProcessXML" />
<XTextButton :title="$t('bpm.design.previewXml')" @click="previewProcessXML" />
<br />
<!-- <el-button link @click="previewProcessJson">预览JSON</el-button> -->
<XTextButton title="预览JSON" @click="previewProcessJson" />
<XTextButton :title="$t('bpm.design.previewJson')" @click="previewProcessJson" />
</template>
</el-tooltip>
<el-tooltip
v-if="props.simulation"
effect="light"
:content="simulationStatus ? '退出模拟' : '开启模拟'"
:content="simulationStatus ? $t('bpm.design.exitSimulation') : $t('bpm.design.startSimulation')"
>
<XButton preIcon="ep:cpu" title="模拟" @click="processSimulation" />
<XButton preIcon="ep:cpu" :title="$t('bpm.design.simulation')" @click="processSimulation" />
</el-tooltip>
</ElButtonGroup>
<ElButtonGroup key="align-control">
<el-tooltip effect="light" content="向左对齐">
<!-- <el-button
class="align align-left"
icon="el-icon-s-data"
@click="elementsAlign('left')"
/> -->
<el-tooltip effect="light" content="Align Left">
<XButton
preIcon="fa:align-left"
class="align align-bottom"
@click="elementsAlign('left')"
/>
</el-tooltip>
<el-tooltip effect="light" content="向右对齐">
<!-- <el-button
class="align align-right"
icon="el-icon-s-data"
@click="elementsAlign('right')"
/> -->
<el-tooltip effect="light" content="Align Right">
<XButton
preIcon="fa:align-left"
class="align align-top"
@click="elementsAlign('right')"
/>
</el-tooltip>
<el-tooltip effect="light" content="向上对齐">
<!-- <el-button
class="align align-top"
icon="el-icon-s-data"
@click="elementsAlign('top')"
/> -->
<el-tooltip effect="light" content="Align Top">
<XButton
preIcon="fa:align-left"
class="align align-left"
@click="elementsAlign('top')"
/>
</el-tooltip>
<el-tooltip effect="light" content="向下对齐">
<!-- <el-button
class="align align-bottom"
icon="el-icon-s-data"
@click="elementsAlign('bottom')"
/> -->
<el-tooltip effect="light" content="Align Bottom">
<XButton
preIcon="fa:align-left"
class="align align-right"
@click="elementsAlign('bottom')"
/>
</el-tooltip>
<el-tooltip effect="light" content="水平居中">
<!-- <el-button
class="align align-center"
icon="el-icon-s-data"
@click="elementsAlign('center')"
/> -->
<!-- class="align align-center" -->
<el-tooltip effect="light" content="Center Horizontally">
<XButton
preIcon="fa:align-left"
class="align align-center"
@click="elementsAlign('center')"
/>
</el-tooltip>
<el-tooltip effect="light" content="垂直居中">
<!-- <el-button
class="align align-middle"
icon="el-icon-s-data"
@click="elementsAlign('middle')"
/> -->
<el-tooltip effect="light" content="Center Vertically">
<XButton
preIcon="fa:align-left"
class="align align-middle"
Expand All @@ -116,47 +78,29 @@
</el-tooltip>
</ElButtonGroup>
<ElButtonGroup key="scale-control">
<el-tooltip effect="light" content="缩小视图">
<!-- <el-button
:disabled="defaultZoom < 0.2"
icon="el-icon-zoom-out"
@click="processZoomOut()"
/> -->
<el-tooltip effect="light" content="Zoom Out">
<XButton
preIcon="ep:zoom-out"
@click="processZoomOut()"
:disabled="defaultZoom < 0.2"
/>
</el-tooltip>
<el-button>{{ Math.floor(defaultZoom * 10 * 10) + '%' }}</el-button>
<el-tooltip effect="light" content="放大视图">
<!-- <el-button
:disabled="defaultZoom > 4"
icon="el-icon-zoom-in"
@click="processZoomIn()"
/> -->
<el-tooltip effect="light" content="Zoom In">
<XButton preIcon="ep:zoom-in" @click="processZoomIn()" :disabled="defaultZoom > 4" />
</el-tooltip>
<el-tooltip effect="light" content="重置视图并居中">
<!-- <el-button icon="el-icon-c-scale-to-original" @click="processReZoom()" /> -->
<el-tooltip effect="light" content="Reset View and Center">
<XButton preIcon="ep:scale-to-original" @click="processReZoom()" />
</el-tooltip>
</ElButtonGroup>
<ElButtonGroup key="stack-control">
<el-tooltip effect="light" content="撤销">
<!-- <el-button :disabled="!revocable" icon="el-icon-refresh-left" @click="processUndo()" /> -->
<el-tooltip effect="light" content="Undo">
<XButton preIcon="ep:refresh-left" @click="processUndo()" :disabled="!revocable" />
</el-tooltip>
<el-tooltip effect="light" content="恢复">
<!-- <el-button
:disabled="!recoverable"
icon="el-icon-refresh-right"
@click="processRedo()"
/> -->
<el-tooltip effect="light" content="Redo">
<XButton preIcon="ep:refresh-right" @click="processRedo()" :disabled="!recoverable" />
</el-tooltip>
<el-tooltip effect="light" content="重新绘制">
<!-- <el-button icon="el-icon-refresh" @click="processRestart" /> -->
<el-tooltip effect="light" content="Reset">
<XButton preIcon="ep:refresh" @click="processRestart()" />
</el-tooltip>
</ElButtonGroup>
Expand Down Expand Up @@ -206,7 +150,7 @@ import BpmnModeler from 'bpmn-js/lib/Modeler'
import DefaultEmptyXML from './plugins/defaultEmpty'
// 翻译方法
import customTranslate from './plugins/translate/customTranslate'
import translationsCN from './plugins/translate/zh'
import translationsCN from './plugins/translate/en'
// 模拟流转流程
import tokenSimulation from 'bpmn-js-token-simulation'
// 标签解析构建器
Expand Down Expand Up @@ -611,13 +555,12 @@ const elementsAlign = (align) => {
const Selection = bpmnModeler.get('selection')
const SelectedElements = Selection.get()
if (!SelectedElements || SelectedElements.length <= 1) {
ElMessage.warning('请按住 Shift 键选择多个元素对齐')
// alert('请按住 Ctrl 键选择多个元素对齐
ElMessage.warning('Please hold Shift key to select multiple elements for alignment')
return
}
ElMessageBox.confirm('自动对齐可能造成图形变形,是否继续?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
ElMessageBox.confirm('Automatic alignment may cause shape distortion. Continue?', 'Warning', {
confirmButtonText: 'Confirm',
cancelButtonText: 'Cancel',
type: 'warning'
}).then(() => {
Align.trigger(SelectedElements, align)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ F.prototype.getPaletteEntries = function () {
'hand-tool': {
group: 'tools',
className: 'bpmn-icon-hand-tool',
title: '激活抓手工具',
// title: translate("Activate the hand tool"),
// title: '激活抓手工具',
title: translate("Activate the hand tool"),
action: {
click: function (event) {
handTool.activateHand(event)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
export default {
"Activate create/remove space tool": "Activate create/remove space tool",
"Activate global connect tool": "Activate global connect tool",
"Activate hand tool": "Activate hand tool",
"Activate lasso tool": "Activate lasso tool",
"Ad-hoc": "Ad-hoc",
"Ad-hoc sub-process (collapsed)": "Ad-hoc sub-process (collapsed)",
"Ad-hoc sub-process (expanded)": "Ad-hoc sub-process (expanded)",
"Add lane above": "Add lane above",
"Add lane below": "Add lane below",
"Add text annotation": "Add text annotation",
"Align elements": "Align elements",
"Align elements bottom": "Align elements bottom",
"Align elements center": "Align elements center",
"Align elements left": "Align elements left",
"Align elements middle": "Align elements middle",
"Align elements right": "Align elements right",
"Align elements top": "Align elements top",
"Append compensation activity": "Append compensation activity",
"Append conditional intermediate catch event": "Append conditional intermediate catch event",
"Append end event": "Append end event",
"Append gateway": "Append gateway",
"Append intermediate/boundary event": "Append intermediate/boundary event",
"Append message intermediate catch event": "Append message intermediate catch event",
"Append receive task": "Append receive task",
"Append signal intermediate catch event": "Append signal intermediate catch event",
"Append task": "Append task",
"Append text annotation": "Append text annotation",
"Append timer intermediate catch event": "Append timer intermediate catch event",
"Business rule task": "Business rule task",
"Call activity": "Call activity",
"Cancel boundary event": "Cancel boundary event",
"Cancel end event": "Cancel end event",
"Change element": "Change element",
"Change type": "Change type",
"Collection": "Collection",
"Compensation boundary event": "Compensation boundary event",
"Compensation end event": "Compensation end event",
"Compensation intermediate throw event": "Compensation intermediate throw event",
"Compensation start event": "Compensation start event",
"Complex gateway": "Complex gateway",
"Conditional boundary event": "Conditional boundary event",
"Conditional boundary event (non-interrupting)": "Conditional boundary event (non-interrupting)",
"Conditional flow": "Conditional flow",
"Conditional intermediate catch event": "Conditional intermediate catch event",
"Conditional start event": "Conditional start event",
"Conditional start event (non-interrupting)": "Conditional start event (non-interrupting)",
"Connect to other element": "Connect to other element",
"Connect using association": "Connect using association",
"Connect using data input association": "Connect using data input association",
"Connect using sequence/message flow or association": "Connect using sequence/message flow or association",
"Create data object reference": "Create data object reference",
"Create data store reference": "Create data store reference",
"Create end event": "Create end event",
"Create expanded sub-process": "Create expanded sub-process",
"Create gateway": "Create gateway",
"Create group": "Create group",
"Create intermediate/boundary event": "Create intermediate/boundary event",
"Create pool/participant": "Create pool/participant",
"Create start event": "Create start event",
"Create task": "Create task",
"Data object reference": "Data object reference",
"Data store reference": "Data store reference",
"Default flow": "Default flow",
"Delete": "Delete",
"Distribute elements horizontally": "Distribute elements horizontally",
"Distribute elements vertically": "Distribute elements vertically",
"Divide into three lanes": "Divide into three lanes",
"Divide into two lanes": "Divide into two lanes",
"Empty pool/participant": "Empty pool/participant",
"Empty pool/participant (removes content)": "Empty pool/participant (removes content)",
"End event": "End event",
"Error boundary event": "Error boundary event",
"Error end event": "Error end event",
"Error start event": "Error start event",
"Escalation boundary event": "Escalation boundary event",
"Escalation boundary event (non-interrupting)": "Escalation boundary event (non-interrupting)",
"Escalation end event": "Escalation end event",
"Escalation intermediate throw event": "Escalation intermediate throw event",
"Escalation start event": "Escalation start event",
"Escalation start event (non-interrupting)": "Escalation start event (non-interrupting)",
"Event sub-process": "Event sub-process",
"Event-based gateway": "Event-based gateway",
"Exclusive gateway": "Exclusive gateway",
"Inclusive gateway": "Inclusive gateway",
"Intermediate throw event": "Intermediate throw event",
"Link intermediate catch event": "Link intermediate catch event",
"Link intermediate throw event": "Link intermediate throw event",
"Loop": "Loop",
"Manual task": "Manual task",
"Message boundary event": "Message boundary event",
"Message boundary event (non-interrupting)": "Message boundary event (non-interrupting)",
"Message end event": "Message end event",
"Message intermediate catch event": "Message intermediate catch event",
"Message intermediate throw event": "Message intermediate throw event",
"Message start event": "Message start event",
"Message start event (non-interrupting)": "Message start event (non-interrupting)",
"Open {element}": "Open {element}",
"Parallel gateway": "Parallel gateway",
"Parallel multi-instance": "Parallel multi-instance",
"Participant multiplicity": "Participant multiplicity",
"Receive task": "Receive task",
"Remove": "Remove",
"Script task": "Script task",
"Search in diagram": "Search in diagram",
"Send task": "Send task",
"Sequence flow": "Sequence flow",
"Sequential multi-instance": "Sequential multi-instance",
"Service task": "Service task",
"Signal boundary event": "Signal boundary event",
"Signal boundary event (non-interrupting)": "Signal boundary event (non-interrupting)",
"Signal end event": "Signal end event",
"Signal intermediate catch event": "Signal intermediate catch event",
"Signal intermediate throw event": "Signal intermediate throw event",
"Signal start event": "Signal start event",
"Signal start event (non-interrupting)": "Signal start event (non-interrupting)",
"Start event": "Start event",
"Sub-process": "Sub-process",
"Sub-process (collapsed)": "Sub-process (collapsed)",
"Sub-process (expanded)": "Sub-process (expanded)",
"Task": "Task",
"Terminate end event": "Terminate end event",
"Timer boundary event": "Timer boundary event",
"Timer boundary event (non-interrupting)": "Timer boundary event (non-interrupting)",
"Timer intermediate catch event": "Timer intermediate catch event",
"Timer start event": "Timer start event",
"Timer start event (non-interrupting)": "Timer start event (non-interrupting)",
"Toggle non-interrupting": "Toggle non-interrupting",
"Transaction": "Transaction",
"User task": "User task",
"already rendered {element}": "already rendered {element}",
"correcting missing bpmnElement on {plane} to {rootElement}": "correcting missing bpmnElement on {plane} to {rootElement}",
"diagram not part of bpmn:Definitions": "diagram not part of bpmn:Definitions",
"element required": "element required",
"element {element} referenced by {referenced}#{property} not yet drawn": "element {element} referenced by {referenced}#{property} not yet drawn",
"failed to import {element}": "failed to import {element}",
"flow elements must be children of pools/participants": "flow elements must be children of pools/participants",
"missing {semantic}#attachedToRef": "missing {semantic}#attachedToRef",
"more than {count} child lanes": "more than {count} child lanes",
"multiple DI elements defined for {element}": "multiple DI elements defined for {element}",
"no bpmnElement referenced in {element}": "no bpmnElement referenced in {element}",
"no diagram to display": "no diagram to display",
"no parent for {element} in {parent}": "no parent for {element} in {parent}",
"no plane for {element}": "no plane for {element}",
"no process or collaboration to display": "no process or collaboration to display",
"no shape type specified": "no shape type specified",
"out of bounds release": "out of bounds release",
"unknown di {di} for element {semantic}": "unknown di {di} for element {semantic}",
"unrecognized flowElement {element} in context {context}": "unrecognized flowElement {element} in context {context}",
"unsupported bpmnElement for {plane}: {rootElement}": "unsupported bpmnElement for {plane}: {rootElement}",
"{semantic}#{side} Ref not specified": "{semantic}#{side} Ref not specified"
};
Loading