app/assets/javascripts/i18n.js in i18n-js-3.7.1 vs app/assets/javascripts/i18n.js in i18n-js-3.8.0
- old
+ new
@@ -400,11 +400,11 @@
fullScope = this.getFullScope(scope, options);
while (locales.length) {
locale = locales.shift();
- scopes = fullScope.split(this.defaultSeparator);
+ scopes = fullScope.split(options.separator || this.defaultSeparator);
translations = this.translations[locale];
if (!translations) {
continue;
}
@@ -457,11 +457,11 @@
;
scope = this.getFullScope(scope, options);
while (locales.length) {
locale = locales.shift();
- scopes = scope.split(this.defaultSeparator);
+ scopes = scope.split(options.separator || this.defaultSeparator);
translations = this.translations[locale];
if (!translations) {
continue;
}
@@ -683,11 +683,11 @@
function(match, p1, p2) {return p1 + ' ' + p2.toLowerCase()} );
}
var localeForTranslation = (options != null && options.locale != null) ? options.locale : this.currentLocale();
var fullScope = this.getFullScope(scope, options);
- var fullScopeWithLocale = [localeForTranslation, fullScope].join(this.defaultSeparator);
+ var fullScopeWithLocale = [localeForTranslation, fullScope].join(options.separator || this.defaultSeparator);
return '[missing "' + fullScopeWithLocale + '" translation]';
};
// Return a missing placeholder message for given parameters
@@ -1023,22 +1023,25 @@
var kb = 1024
, size = number
, iterations = 0
, unit
, precision
+ , fullScope
;
while (size >= kb && iterations < 4) {
size = size / kb;
iterations += 1;
}
if (iterations === 0) {
- unit = this.t("number.human.storage_units.units.byte", {count: size});
+ fullScope = this.getFullScope("number.human.storage_units.units.byte", options);
+ unit = this.t(fullScope, {count: size});
precision = 0;
} else {
- unit = this.t("number.human.storage_units.units." + SIZE_UNITS[iterations]);
+ fullScope = this.getFullScope("number.human.storage_units.units." + SIZE_UNITS[iterations], options);
+ unit = this.t(fullScope);
precision = (size - Math.floor(size) === 0) ? 0 : 1;
}
options = this.prepareOptions(
options
@@ -1051,18 +1054,18 @@
I18n.getFullScope = function(scope, options) {
options = options || {};
// Deal with the scope as an array.
if (isArray(scope)) {
- scope = scope.join(this.defaultSeparator);
+ scope = scope.join(options.separator || this.defaultSeparator);
}
// Deal with the scope option provided through the second argument.
//
// I18n.t('hello', {scope: 'greetings'});
//
if (options.scope) {
- scope = [options.scope, scope].join(this.defaultSeparator);
+ scope = [options.scope, scope].join(options.separator || this.defaultSeparator);
}
return scope;
};
/**