@contentstack/cli-cm-bootstrap
Version:
Bootstrap contentstack apps
22 lines (21 loc) • 608 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const messageFile = require('../messages/index.json');
class Messages {
constructor() {
this.messages = messageFile;
}
parse(messageKey, ...substitutions) {
const msg = this.messages[messageKey];
if (!msg) {
return;
}
if (substitutions.length > 0) {
const callSite = msg.split('%s');
callSite.push('');
return String.raw({ raw: callSite }, ...substitutions);
}
return msg;
}
}
exports.default = new Messages();