source/i18n.js in i18n-js-0.1.5 vs source/i18n.js in i18n-js-0.1.6
- old
+ new
@@ -303,24 +303,32 @@
number = this.toNumber(number, options);
return number + "%";
};
I18n.pluralize = function(count, scope, options) {
- var translation = this.lookup(scope, options);
-
+ var translation;
+
+ try {
+ translation = this.lookup(scope, options);
+ } catch (error) {}
+
+ if (!translation) {
+ return this.missingTranslation(scope);
+ }
+
var message;
options = this.prepareOptions(options);
options["count"] = count.toString();
switch(Math.abs(count)) {
case 0:
message = translation["zero"] || translation["none"] || translation["other"] || this.missingTranslation(scope, "zero");
break;
case 1:
- message = translation["one"] || this.missingTranslation(scope, "one");;
+ message = translation["one"] || this.missingTranslation(scope, "one");
break;
default:
- message = translation["other"] || this.missingTranslation(scope, "other");;
+ message = translation["other"] || this.missingTranslation(scope, "other");
}
return this.interpolate(message, options);
};