From cf47e9ebb92db50be9a66e3b634b8eeaec434c09 Mon Sep 17 00:00:00 2001 From: oscarotero Date: Wed, 15 Jun 2016 21:29:54 +0200 Subject: [PATCH] make plural-forms optional --- src/translator.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/translator.js b/src/translator.js index 9232ab2..cc7db03 100644 --- a/src/translator.js +++ b/src/translator.js @@ -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;