Files
ipms-sjy/yudao-admin-ui/src/components/bpmn/data/translate/customTranslate.js
2021-11-18 12:06:24 +08:00

13 lines
330 B
JavaScript

import translations from './zn'
export default function customTranslate(template, replacements) {
replacements = replacements || {};
// Translate
template = translations[template] || template;
// Replace
return template.replace(/{([^}]+)}/g, function(_, key) {
return replacements[key] || '{' + key + '}';
});
}