Skip to content

Commit

Permalink
chore: extract default translate from diagram-js
Browse files Browse the repository at this point in the history
  • Loading branch information
barmac committed Jan 24, 2024
1 parent ac3abe6 commit a6f1e85
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/cloud-element-templates/util/propertyUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import {
is
} from 'bpmn-js/lib/util/ModelUtil';

import defaultTranslate from 'diagram-js/lib/i18n/translate/translate';

import {
isString,
isUndefined, without
Expand Down Expand Up @@ -931,3 +929,12 @@ function isOnlyProperty(moddleElement, propertyName) {
return propertyName === name || moddleElement.get(name) === undefined;
});
}

function defaultTranslate(template, replacements) {

replacements = replacements || {};

return template.replace(/{([^}]+)}/g, function(_, key) {
return replacements[key] || '{' + key + '}';
});
}

0 comments on commit a6f1e85

Please sign in to comment.