app/assets/javascripts/i18n.js in i18n-js-3.0.11 vs app/assets/javascripts/i18n.js in i18n-js-3.1.0
- old
+ new
@@ -573,20 +573,22 @@
options = options || {}
var translationOptions = this.createTranslationOptions(scope, options);
var translation;
+ var usedScope = scope;
var optionsWithoutDefault = this.prepareOptions(options)
delete optionsWithoutDefault.defaultValue
// Iterate through the translation options until a translation
// or message is found.
var translationFound =
translationOptions.some(function(translationOption) {
if (isSet(translationOption.scope)) {
- translation = this.lookup(translationOption.scope, optionsWithoutDefault);
+ usedScope = translationOption.scope;
+ translation = this.lookup(usedScope, optionsWithoutDefault);
} else if (isSet(translationOption.message)) {
translation = lazyEvaluate(translationOption.message, scope);
}
if (translation !== undefined && translation !== null) {
@@ -603,10 +605,10 @@
} else if (isArray(translation)) {
translation = translation.map(function(t) {
return (typeof(t) === "string" ? this.interpolate(t, options) : t);
}, this);
} else if (isObject(translation) && isSet(options.count)) {
- translation = this.pluralize(options.count, scope, options);
+ translation = this.pluralize(options.count, usedScope, options);
}
return translation;
};