Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
f6ba8817
authored
Jun 15, 2025
by
芋道源码
Committed by
GitHub
Jun 15, 2025
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #154 from cactuer/bpmn-translate-branch
修复BPMN流程设计器组件翻译问题
parents
8665d0a4
c13f3b86
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
18 deletions
+17
-18
src/components/bpmnProcessDesigner/package/designer/plugins/translate/customTranslate.js
+15
-16
src/components/bpmnProcessDesigner/package/designer/plugins/translate/zh.js
+2
-2
No files found.
src/components/bpmnProcessDesigner/package/designer/plugins/translate/customTranslate.js
View file @
f6ba8817
...
...
@@ -23,22 +23,20 @@
export
default
function
customTranslate
(
translations
)
{
return
function
(
template
,
replacements
)
{
replacements
=
replacements
||
{}
// Translate
template
=
translations
[
template
]
||
template
replacements
=
replacements
||
{};
// 将模板和翻译字典的键统一转换为小写进行匹配
const
lowerTemplate
=
template
.
toLowerCase
();
const
translation
=
Object
.
keys
(
translations
).
find
(
key
=>
key
.
toLowerCase
()
===
lowerTemplate
);
// Replace
return
template
.
replace
(
/{
([^
}
]
+
)
}/g
,
function
(
_
,
key
)
{
let
str
=
replacements
[
key
]
if
(
translations
[
replacements
[
key
]]
!==
null
&&
translations
[
replacements
[
key
]]
!==
undefined
)
{
// eslint-disable-next-line no-mixed-spaces-and-tabs
str
=
translations
[
replacements
[
key
]]
// eslint-disable-next-line no-mixed-spaces-and-tabs
}
return
str
||
'{'
+
key
+
'}'
})
// 如果找到匹配的翻译,使用翻译后的模板
if
(
translation
)
{
template
=
translations
[
translation
];
}
// 替换模板中的占位符
return
template
.
replace
(
/{
([^
}
]
+
)
}/g
,
function
(
_
,
key
)
{
// 如果替换值存在,返回替换值;否则返回原始占位符
return
replacements
[
key
]
!==
undefined
?
replacements
[
key
]
:
`{
${
key
}
}`
;
});
};
}
\ No newline at end of file
src/components/bpmnProcessDesigner/package/designer/plugins/translate/zh.js
View file @
f6ba8817
...
...
@@ -45,8 +45,8 @@ export default {
'Service Task'
:
'服务任务'
,
'Script Task'
:
'脚本任务'
,
'Call Activity'
:
'调用活动'
,
'Sub
Process (collapsed)'
:
'子流程(折叠的)'
,
'Sub
Process (expanded)'
:
'子流程(展开的)'
,
'Sub
-
Process (collapsed)'
:
'子流程(折叠的)'
,
'Sub
-
Process (expanded)'
:
'子流程(展开的)'
,
'Start Event'
:
'开始事件'
,
StartEvent
:
'开始事件'
,
'Intermediate Throw Event'
:
'中间事件'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment