moodle_local_treestudyplan/amd/build/util/string-helper.min.js

3 lines
1.5 KiB
JavaScript
Raw Normal View History

2024-06-03 23:24:16 +02:00
define("local_treestudyplan/util/string-helper",["exports","core/str","./debugger"],(function(_exports,_str,_debugger){var obj;Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.loadStringKeys=function(string_keys,plugin){void 0===plugin&&(plugin="local_treestudyplan");for(let idx in string_keys){let stringkeys=[];for(const i in string_keys[idx]){let parts=string_keys[idx][i].textkey.split("$"),identifier=parts[0],component=parts.length>1?parts[1]:plugin;stringkeys.push({key:identifier,component:component})}getstrFunc(stringkeys).then((function(strings){for(const i in strings){const s=strings[i];string_keys[idx][i].text=s}})).catch((x=>{debug.warn(x)}))}return string_keys},_exports.loadStrings=function(strings,plugin){void 0===plugin&&(plugin="local_treestudyplan");for(let idx in strings){let stringkeys=[];for(const handle in strings[idx]){let parts=strings[idx][handle].split(/[$@]/),identifier=parts[0],component=parts.length>1?parts[1]:plugin;stringkeys.push({key:identifier,component:component})}getstrFunc(stringkeys).then((function(str){let i=0;for(const handle in strings[idx])strings[idx][handle]=str[i],i++})).catch((x=>{debug.warn(x)}))}return strings},_exports.strformat=function(str,values){return str.replace(/\{(\w+)\}/g,((m,m1)=>m1&&values.hasOwnProperty(m1)?values[m1]:m))};let debug=new(_debugger=(obj=_debugger)&&obj.__esModule?obj:{default:obj}).default("string-helper");const getstrFunc=void 0!==_str.getStrings?_str.getStrings:_str.get_strings}));
2023-08-19 17:54:40 +02:00
//# sourceMappingURL=string-helper.min.js.map