Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Issue 5836 (Numbers formatting doesn't respect locale settings)

  • Loading branch information...
commit ba6057bfda54d8cd32a131626cebbd48a8ea6ec5 1 parent ffe9c81
@SebastianZ SebastianZ authored
View
25 extension/content/firebug/lib/string.js
@@ -630,17 +630,12 @@ Str.cleanIndentation = function(text)
// ************************************************************************************************
// Formatting
-Str.formatNumber = function(number)
-{
- number += "";
- var x = number.split(".");
- var x1 = x[0];
- var x2 = x.length > 1 ? "." + x[1] : "";
- var rgx = /(\d+)(\d{3})/;
- while (rgx.test(x1))
- x1 = x1.replace(rgx, "$1" + "," + "$2");
- return x1 + x2;
-}
+
+//deprecated compatibility functions
+Str.deprecateEscapeHTML = createSimpleEscape("text", "normal");
+
+Str.formatNumber = Deprecated.deprecated("use <number>.toLocaleString() instead",
+ function(number) { return number.toLocaleString(); });
Str.formatSize = function(bytes)
{
@@ -670,13 +665,13 @@ Str.formatSize = function(bytes)
if (bytes == -1 || bytes == undefined)
return "?";
else if (bytes == 0)
- return "0";
+ return "0 B";
else if (bytes < 1024)
- result = bytes + " B";
+ result = bytes.toLocaleString() + " B";
else if (bytes < (1024*1024))
- result = Math.round((bytes/1024)*a)/a + " KB";
+ result = (Math.round((bytes/1024)*a)/a).toLocaleString() + " KB";
else
- result = Math.round((bytes/(1024*1024))*a)/a + " MB";
+ result = (Math.round((bytes/(1024*1024))*a)/a).toLocaleString() + " MB";
return negative ? "-" + result : result;
}
View
6 extension/content/firebug/net/netReps.js
@@ -491,14 +491,14 @@ Firebug.NetMonitor.NetRequestEntry = domplate(Firebug.Rep, new Firebug.Listener(
TD({"class": "netCol netProtocolCol a11yFocus", "role" : "gridcell"}),
TD({"class": "netCol netDomainCol a11yFocus", "role" : "gridcell"}),
TD({"class": "netTotalSizeCol netCol netSizeCol a11yFocus", "role": "gridcell"},
- DIV({"class": "netTotalSizeLabel netSummaryLabel"}, "0KB")
+ DIV({"class": "netTotalSizeLabel netSummaryLabel"}, "0 B")
),
TD({"class": "netTotalTimeCol netCol netTimeCol a11yFocus", "role":
"gridcell", colspan: "3"},
DIV({"class": "netSummaryBar", style: "width: 100%"},
DIV({"class": "netCacheSizeLabel netSummaryLabel", collapsed: "true"},
"(",
- SPAN("0KB"),
+ SPAN("0 B"),
SPAN(" " + Locale.$STR("FromCache")),
")"
),
@@ -1965,7 +1965,7 @@ Firebug.NetMonitor.SizeInfoTip = domplate(Firebug.Rep,
formatNumber: function(size)
{
- return size.size && size.size >= 1024 ? "(" + Str.formatNumber(size.size) + " B)" : "";
+ return size.size && size.size >= 1024 ? "(" + size.size.toLocaleString() + " B)" : "";
},
render: function(file, parentNode)
Please sign in to comment.
Something went wrong with that request. Please try again.