hi
customTranslateModule in CMMN js not work
import CmmnModeler from 'cmmn-js/lib/Modeler';
import customTranslate from './customTranslate/customTranslate';
var customTranslateModule = {
translate: [ 'value', customTranslate ]
};
var cmmnModeler = new CmmnModeler({
container: '#canvas',
additionalModules: [
customTranslateModule
]
});
customTranslateModule Code
import translations from './translations';
export default function customTranslate(template, replacements) {
replacements = replacements || {};
console.log(template);
// Translate
template = translations[template] || template;
// Replace
return template.replace(/{([^}]+)}/g, function(_, key) {
return replacements[key] || '{' + key + '}';
});
}
translations.js
/**
* This is a sample file that should be replaced with the actual translation.
*
* Checkout https://github.com/bpmn-io/bpmn-js-i18n for a list of available
* translations and labels to translate.
*/
export default {
'Task':'new name',
};