Skip to content

Commit

Permalink
Release 0.2.12
Browse files Browse the repository at this point in the history
  • Loading branch information
seeden committed Nov 28, 2015
1 parent e241a87 commit 4c59601
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ npm install translate-maker
# Features

- Build on standards ([ICU Message syntax](http://userguide.icu-project.org/formatparse/messages), [Unicode CLDR](http://cldr.unicode.org/))
- Support 190+ languages
- JSON Structure
- Nested and reference translations
- Variables
Expand Down
11 changes: 10 additions & 1 deletion dist/filters/plural.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,17 @@ var _cldr = require('cldr');

var _cldr2 = _interopRequireDefault(_cldr);

var cachePlural = null;

function plural(locale, count) {
var fn = _cldr2['default'].extractPluralRuleFunction(locale);
if (!cachePlural || cachePlural.locale !== locale) {
cachePlural = {
locale: locale,
fn: _cldr2['default'].extractPluralRuleFunction(locale)
};
}

var fn = cachePlural.fn;

return fn(count);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "translate-maker",
"version": "0.2.11",
"version": "0.2.12",
"description": "Universal translation library",
"main": "dist/index.js",
"keywords": [
Expand Down
11 changes: 10 additions & 1 deletion src/filters/plural.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import find from 'lodash/collection/find';
import cldr from 'cldr';

let cachePlural = null;

function plural(locale, count) {
const fn = cldr.extractPluralRuleFunction(locale);
if (!cachePlural || cachePlural.locale !== locale) {
cachePlural = {
locale,
fn: cldr.extractPluralRuleFunction(locale),
};
}

const fn = cachePlural.fn;

return fn(count);
}
Expand Down

0 comments on commit 4c59601

Please sign in to comment.