module.exports = (function () { var makePlural = function(name) { if (name.slice(-1) === 's') { return name; } if (name.slice(-1) === 'y') { name = name.slice(0,-1) + 'ie'; } return name + 's'; } return function AutoTEntityTPluralPlugin() { this.configPlugin = function (ctx) { ctx.key='autoTEntityTPlural'; ctx.description='Auto create tplurals from the tname/tid field.'; ctx.dependencies.push('autoTName'); }; this.fillTEntity = function(ctx) { if (ctx.tentity.tplural === null) { if (ctx.tentity.tname === null) { ctx.tentity.tplural = makePlural(ctx.tentity.tid); } else { ctx.tentity.tplural = makePlural(ctx.tentity.tname); } } }; }; })();