1 Star 0 Fork 0

韩彭飞/bpmn-js-examples

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

bpmn-js i18n Example

This example shows how to easily translate the strings displayed in bpmn-js to another language.

Screenshot

Usage Summary

The custom translation function is provided as an additional module when bpmn-js is instantiated. The default translation implementation is thereby overwritten.

var customTranslate = {
  translate: [ 'value', require('./custom-translate/custom-translate') ]
};

var modeler = new BpmnModeler({
  // ...
  additionalModules: [
    customTranslate
  ]
});

You can use your own implementation for translation. The function has two arguments (a template string and an optional object with replacements) and must return the translated string. The example provides two main functionalities: translating and replacing template strings.

Translating a string:

var translations = {
  'Append': 'Anhängen'
};

//...

translate('Append'); // Returns 'Anhängen'

Translating a template string:

var translations = {
  'Append {element}': '{element} anhängen'
};

//...

translate('Append {element}', {element: 'Gateway'}); // Returns 'Gateway anhängen'

A list of all available template strings of bpmn-js as well as existing translations can be found in the bpmn-js-i18n repository.

Run the Example

You need a NodeJS development stack with npm installed to build the project.

To install all project dependencies execute

npm install

To start the example execute

npm start

To build the example into the public folder execute

npm run all
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/hanpf/bpmn-js-examples.git
git@gitee.com:hanpf/bpmn-js-examples.git
hanpf
bpmn-js-examples
bpmn-js-examples
master

搜索帮助