framework.helpers.res = function(key, value) {
// this === controller
var self = this;
// text test with {0} - {0} will be replaced with the value
return (self.resource(self.repository.resource || 'default', key) || '').format(value);
};
framework.helpers.resSet = function(key) {
this.repository.resource = key || 'default';
// IMPORTANT:
return '';
};
<h1>TEST</h1>
@{resSet('en')}
<div>
@{res('key1', 'my title')}
@{res('key1', 'my title').pluralize('zero', 'one', 'few', 'other')}
</div>
var self = this;
framework.helpers.resSet.call(self, 'en');
console.log(framework.helpers.res.call(self, 'key1', 'my title'));