mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1009795 - Part 2: Revert to the old gDecimalSymbol hack if the Internationalization API is not available; r=mak
This will be removed in bug 1200494.
This commit is contained in:
parent
9869a058a8
commit
196aab7dc0
@ -46,6 +46,11 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
|
||||
"resource://gre/modules/PluralForm.jsm");
|
||||
|
||||
this.__defineGetter__("gDecimalSymbol", function() {
|
||||
delete this.gDecimalSymbol;
|
||||
return this.gDecimalSymbol = Number(5.4).toLocaleString().match(/\D/);
|
||||
});
|
||||
|
||||
let localeNumberFormatCache = new Map();
|
||||
function getLocaleNumberFormat(fractionDigits) {
|
||||
// Backward compatibility: don't use localized digits
|
||||
@ -478,8 +483,13 @@ this.DownloadUtils = {
|
||||
if (aBytes === Infinity) {
|
||||
aBytes = "Infinity";
|
||||
} else {
|
||||
aBytes = getLocaleNumberFormat(fractionDigits)
|
||||
.format(aBytes);
|
||||
if (Intl) {
|
||||
aBytes = getLocaleNumberFormat(fractionDigits)
|
||||
.format(aBytes);
|
||||
} else if (gDecimalSymbol != ".") {
|
||||
// FIXME: Fall back to the old hack, will be fixed in bug 1200494.
|
||||
aBytes = aBytes.toFixed(fractionDigits).replace(".", gDecimalSymbol);
|
||||
}
|
||||
}
|
||||
|
||||
return [aBytes, gBundle.GetStringFromName(gStr.units[unitIndex])];
|
||||
|
Loading…
Reference in New Issue
Block a user