diff --git a/gui/default/index.html b/gui/default/index.html
index e49d8ffc..5af082b9 100644
--- a/gui/default/index.html
+++ b/gui/default/index.html
@@ -321,9 +321,9 @@
| Global State |
-
- {{model[folder.id].globalFiles | alwaysNumber}}
- {{model[folder.id].globalDirectories | alwaysNumber}}
+
+ {{model[folder.id].globalFiles | alwaysNumber | localeNumber}}
+ {{model[folder.id].globalDirectories | alwaysNumber | localeNumber}}
~{{model[folder.id].globalBytes | binary}}B
|
@@ -331,9 +331,9 @@
| Local State |
-
- {{model[folder.id].localFiles | alwaysNumber}}
- {{model[folder.id].localDirectories | alwaysNumber}}
+
+ {{model[folder.id].localFiles | alwaysNumber | localeNumber}}
+ {{model[folder.id].localDirectories | alwaysNumber | localeNumber}}
~{{model[folder.id].localBytes | binary}}B
Reduced by ignore patterns
@@ -355,7 +355,7 @@
| Failed Items |
- {{model[folder.id].pullErrors | alwaysNumber}} items
+ {{model[folder.id].pullErrors | alwaysNumber | localeNumber}} items
|
@@ -532,9 +532,9 @@
| Local State (Total) |
-
- {{localStateTotal.files | alwaysNumber}}
- {{localStateTotal.directories| alwaysNumber}}
+
+ {{localStateTotal.files | alwaysNumber | localeNumber}}
+ {{localStateTotal.directories| alwaysNumber | localeNumber}}
~{{localStateTotal.bytes | binary}}B
|
@@ -544,7 +544,7 @@
| CPU Utilization |
- {{system.cpuPercent | alwaysNumber | natural:1}}% |
+ {{system.cpuPercent | alwaysNumber | localeNumber:2}}% |
| Listeners |
@@ -635,7 +635,7 @@
| Out of Sync Items |
- {{completion[deviceCfg.deviceID]._needItems | alwaysNumber}} items, ~{{completion[deviceCfg.deviceID]._needBytes | binary}}B
+ {{completion[deviceCfg.deviceID]._needItems | alwaysNumber | localeNumber}} items, ~{{completion[deviceCfg.deviceID]._needBytes | binary}}B
|
@@ -784,6 +784,7 @@
+
@@ -791,7 +792,6 @@
-
diff --git a/gui/default/syncthing/app.js b/gui/default/syncthing/app.js
index ac9c89cb..d2e1d96c 100644
--- a/gui/default/syncthing/app.js
+++ b/gui/default/syncthing/app.js
@@ -82,18 +82,6 @@ function folderList(m) {
return l;
}
-function decimals(val, num) {
- var digits, decs;
-
- if (val === 0) {
- return 0;
- }
-
- digits = Math.floor(Math.log(Math.abs(val)) / Math.log(10));
- decs = Math.max(0, num - digits);
- return decs;
-}
-
function isEmptyObject(obj) {
var name;
for (name in obj) {
diff --git a/gui/default/syncthing/core/binaryFilter.js b/gui/default/syncthing/core/binaryFilter.js
index e9e30e06..0836bae5 100644
--- a/gui/default/syncthing/core/binaryFilter.js
+++ b/gui/default/syncthing/core/binaryFilter.js
@@ -6,16 +6,16 @@ angular.module('syncthing.core')
}
if (input > 1024 * 1024 * 1024) {
input /= 1024 * 1024 * 1024;
- return input.toFixed(decimals(input, 2)) + ' Gi';
+ return input.toLocaleString(undefined, {maximumFractionDigits: 2}) + ' Gi';
}
if (input > 1024 * 1024) {
input /= 1024 * 1024;
- return input.toFixed(decimals(input, 2)) + ' Mi';
+ return input.toLocaleString(undefined, {maximumFractionDigits: 2}) + ' Mi';
}
if (input > 1024) {
input /= 1024;
- return input.toFixed(decimals(input, 2)) + ' Ki';
+ return input.toLocaleString(undefined, {maximumFractionDigits: 2}) + ' Ki';
}
- return Math.round(input) + ' ';
+ return Math.round(input).toLocaleString(undefined, {maximumFractionDigits: 2}) + ' ';
};
});
diff --git a/gui/default/syncthing/core/localeNumberFilter.js b/gui/default/syncthing/core/localeNumberFilter.js
new file mode 100644
index 00000000..7f8a0407
--- /dev/null
+++ b/gui/default/syncthing/core/localeNumberFilter.js
@@ -0,0 +1,9 @@
+angular.module('syncthing.core')
+ .filter('localeNumber', function () {
+ return function (input, decimals) {
+ if (typeof(decimals) !== 'undefined') {
+ return input.toLocaleString(undefined, {maximumFractionDigits: decimals});
+ }
+ return input.toLocaleString();
+ };
+ });
\ No newline at end of file
diff --git a/gui/default/syncthing/core/metricFilter.js b/gui/default/syncthing/core/metricFilter.js
index 8d40e28e..e371410d 100644
--- a/gui/default/syncthing/core/metricFilter.js
+++ b/gui/default/syncthing/core/metricFilter.js
@@ -6,16 +6,16 @@ angular.module('syncthing.core')
}
if (input > 1000 * 1000 * 1000) {
input /= 1000 * 1000 * 1000;
- return input.toFixed(decimals(input, 2)) + ' G';
+ return input.toLocaleString(undefined, {maximumFractionDigits: 2}) + ' G';
}
if (input > 1000 * 1000) {
input /= 1000 * 1000;
- return input.toFixed(decimals(input, 2)) + ' M';
+ return input.toLocaleString(undefined, {maximumFractionDigits: 2}) + ' M';
}
if (input > 1000) {
input /= 1000;
- return input.toFixed(decimals(input, 2)) + ' k';
+ return input.toLocaleString(undefined, {maximumFractionDigits: 2}) + ' k';
}
- return Math.round(input) + ' ';
+ return Math.round(input).toLocaleString(undefined, {maximumFractionDigits: 2}) + ' ';
};
});
diff --git a/gui/default/syncthing/core/naturalFilter.js b/gui/default/syncthing/core/naturalFilter.js
deleted file mode 100644
index a1d80fda..00000000
--- a/gui/default/syncthing/core/naturalFilter.js
+++ /dev/null
@@ -1,6 +0,0 @@
-angular.module('syncthing.core')
- .filter('natural', function () {
- return function (input, valid) {
- return input.toFixed(decimals(input, valid));
- };
- });