bpmn-io / bpmn-js-properties-panel

A properties panel for bpmn-js.
MIT License
286 stars 196 forks source link

Chineseization failed #1056

Closed chen-xiaoxing closed 1 month ago

chen-xiaoxing commented 1 month ago

Describe the Bug

Chineseization failed

Steps to Reproduce

1、I set up Chineseization. Some of the content was successfully Chineseized, but some failed.

Expected Behavior

I hope it can be Chineseized according to the files I configure.

Environment

"@bpmn-io/properties-panel": "^3.3.1", "@elastic/elasticsearch": "^8.9.0", "@element-plus/icons-vue": "^2.1.0", "@types/jquery": "^3.5.16", "axios": "^1.4.0", "bpmn-js": "^13.2.0", "bpmn-js-properties-panel": "^4.0.2", "camunda-bpmn-moddle": "^7.0.1", "core-js": "^3.8.3", "diagram-js": "^12.2.0", "node-polyfill-webpack-plugin": "^2.0.1", "qs": "^6.11.2", "raw-loader": "^4.0.2", "util": "^0.12.5", "vue": "^3.2.13", "vue-axios": "^3.5.2", "vue-class-component": "^8.0.0-0", "zeebe-bpmn-moddle": "^0.19.0" 111

nikku commented 1 month ago

Which files did you configure?

chen-xiaoxing commented 1 month ago

I configure : // translate.js file import translations from "./local/zh";

function customTranslate(template, replacements) { replacements = replacements || {}; template = translations[template] || template;

return template.replace(/{([^}]+)}/g, function(_, key) { let str = replacements[key]; if ( translations[replacements[key]] !== null && translations[replacements[key]] !== "undefined" ) { str = translations[replacements[key]]; } return str || "{" + key + "}"; }); }

export default {translate: [ 'value', customTranslate ]}

// local/zh.js file export default { ... 'Extension properties': '扩展属性', 'Element documentation': '元素文档', 'Create': '新建', 'Outputs': '输出', 'Process variable name':'过程变量名称', 'Variable assignment value':'变量赋值', 'Delete item': '删除这项', }

// demo.vue file import customTranslateModule from "../utils/translate";

var viewer = new BpmnModeler({ container: canvas.value, propertiesPanel: { parent: panel.value }, additionalModules: [ BpmnPropertiesProviderModule, BpmnPropertiesPanelModule, ZeebePropertiesProviderModule,
customTranslateModule, ], moddleExtensions: { zeebe: ZeebeBpmnModdle } });

nikku commented 1 month ago

Ensure you use a recent version of the properties panel. We ship with with translation support for the properties you mentioned.

If there is things missing, please consider to contribute an improvement.