ruoyi-vue-nocode/ruoyi-ui/ruoyi-bpmnjs/resources/customTranslate/customTranslate.js

12 lines
481 B
JavaScript
Raw Normal View History

2022-08-11 16:10:41 +08:00
import translations from './translationsGerman';
export default function customTranslate(template, replacements) {
replacements = replacements || {};
template = translations[template] || template;
return template.replace(/{([^}]+)}/g, function(_, key) {
var str = replacements[key];
if(translations[replacements[key]] != null && translations [replacements[key]] != 'undefined'){
str = translations[replacements[key]];
}
return str || '{' + key + '}';
});
}