Skip to content

Commit

Permalink
make plural-forms optional
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarotero committed Jun 15, 2016
1 parent 81c2d1f commit cf47e9e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/translator.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@
return this;
}

var plural = translations['plural-forms'].split(';', 2);
if (translations['plural-forms']) {
var plural = translations['plural-forms'].split(';', 2);

this.plurals[domain] = {
count: parseInt(plural[0].replace('nplurals=', '')),
code: plural[1].replace('plural=', 'return ') + ';'
};
this.plurals[domain] = {
count: parseInt(plural[0].replace('nplurals=', '')),
code: plural[1].replace('plural=', 'return ') + ';'
};
}

this.dictionary[domain] = translations.messages;

Expand Down

0 comments on commit cf47e9e

Please sign in to comment.