Skip to content

Commit

Permalink
Replaced pluralizer with plurals-cldr
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaly Puzrin committed Dec 14, 2014
1 parent aebdb9e commit b860be4
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 747 deletions.
16 changes: 15 additions & 1 deletion lib/babelfish.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


var parser = require('./babelfish/parser');
var pluralizer = require('./babelfish/pluralizer');
var plural = require('plurals-cldr');

function _class(obj) { return Object.prototype.toString.call(obj); }

Expand Down Expand Up @@ -179,6 +179,20 @@ function searchPhraseKey(self, locale, phrase) {
}


function pluralizer(lang, val, forms) {
var idx = plural.indexOf(lang, val);

if (idx === -1) {
return '[pluralizer for (' + lang + ') not exists]';
}

if (typeof forms[idx] === 'undefined') {
return '[plural form N' + idx + ' not found in translation]';
}

return forms[idx];
}

// public api (module)
////////////////////////////////////////////////////////////////////////////////

Expand Down
Loading

0 comments on commit b860be4

Please sign in to comment.