Files
ipms-sjy/yudao-admin-ui/src/components/bpmn/data/translate/customTranslate.js

13 lines
330 B
JavaScript
Raw Normal View History

2021-11-18 12:06:24 +08:00
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 + '}';
});
}