Skip to content
This repository has been archived by the owner on Jul 1, 2024. It is now read-only.

Commit

Permalink
plural helper
Browse files Browse the repository at this point in the history
  • Loading branch information
viktor committed Jun 14, 2016
1 parent b1ce6a4 commit 75b47bb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/helpers/handlebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ export default function(handlebars) {

});

Handlebars.registerHelper('plural', (...args) => {
const i18nKey = args.shift();
const count = args[0] || 0;

return new Handlebars.SafeString(translator.translate(i18nKey, {count: count}));
});

Handlebars.registerHelper('currency', (amount, decimals) => {
amount = parseFloat(amount);

Expand Down

0 comments on commit 75b47bb

Please sign in to comment.