app/assets/javascripts/i18n.js in i18n-js-3.6.0 vs app/assets/javascripts/i18n.js in i18n-js-3.7.0
- old
+ new
@@ -777,12 +777,12 @@
// You can also override these options by providing the `options` argument.
//
I18n.toCurrency = function(number, options) {
options = this.prepareOptions(
options
- , this.lookup("number.currency.format")
- , this.lookup("number.format")
+ , this.lookup("number.currency.format", options)
+ , this.lookup("number.format", options)
, CURRENCY_FORMAT
);
return this.toNumber(number, options);
};
@@ -797,21 +797,21 @@
I18n.localize = function(scope, value, options) {
options || (options = {});
switch (scope) {
case "currency":
- return this.toCurrency(value);
+ return this.toCurrency(value, options);
case "number":
- scope = this.lookup("number.format");
+ scope = this.lookup("number.format", options);
return this.toNumber(value, scope);
case "percentage":
- return this.toPercentage(value);
+ return this.toPercentage(value, options);
default:
var localizedValue;
if (scope.match(/^(date|time)/)) {
- localizedValue = this.toTime(scope, value);
+ localizedValue = this.toTime(scope, value, options);
} else {
localizedValue = value.toString();
}
return this.interpolate(localizedValue, options);
@@ -912,12 +912,12 @@
// %y - Year without a century (00..99)
// %-y - Year without a century (0..99)
// %Y - Year with century
// %z/%Z - Timezone offset (+0545)
//
- I18n.strftime = function(date, format) {
- var options = this.lookup("date")
+ I18n.strftime = function(date, format, options) {
+ var options = this.lookup("date", options)
, meridianOptions = I18n.meridian()
;
if (!options) {
options = {};
@@ -982,13 +982,13 @@
return format;
};
// Convert the given dateString into a formatted date.
- I18n.toTime = function(scope, dateString) {
+ I18n.toTime = function(scope, dateString, options) {
var date = this.parseDate(dateString)
- , format = this.lookup(scope)
+ , format = this.lookup(scope, options)
;
// A date input of `null` or `undefined` will be returned as-is
if (date == null) {
return date;
@@ -1001,18 +1001,18 @@
if (!format) {
return date_string;
}
- return this.strftime(date, format);
+ return this.strftime(date, format, options);
};
// Convert a number into a formatted percentage value.
I18n.toPercentage = function(number, options) {
options = this.prepareOptions(
options
- , this.lookup("number.percentage.format")
- , this.lookup("number.format")
+ , this.lookup("number.percentage.format", options)
+ , this.lookup("number.format", options)
, PERCENTAGE_FORMAT
);
return this.toNumber(number, options);
};