diff --git a/core/server/helpers/plural.js b/core/server/helpers/plural.js index 0234720c0c..cfd4cd7446 100644 --- a/core/server/helpers/plural.js +++ b/core/server/helpers/plural.js @@ -20,7 +20,7 @@ plural = function (context, options) { } if (context === 0) { - return new hbs.handlebars.SafeString(options.hash.empty); + return new hbs.handlebars.SafeString(options.hash.empty.replace('%', context)); } else if (context === 1) { return new hbs.handlebars.SafeString(options.hash.singular.replace('%', context)); } else if (context >= 2) { diff --git a/core/test/unit/server_helpers/plural_spec.js b/core/test/unit/server_helpers/plural_spec.js index 2da93b151c..f3b7b20e90 100644 --- a/core/test/unit/server_helpers/plural_spec.js +++ b/core/test/unit/server_helpers/plural_spec.js @@ -31,6 +31,20 @@ describe('{{plural}} helper', function () { rendered.string.should.equal(expected); }); + it('will show no-value string with placement', function () { + var expected = '0 Posts', + rendered = helpers.plural.call({}, 0, { + hash: { + empty: '% Posts', + singular: '% Post', + plural: '% Posts' + } + }); + + should.exist(rendered); + rendered.string.should.equal(expected); + }); + it('will show singular string', function () { var expected = '1 Post', rendered = helpers.plural.call({}, 1, {