[Kimchi-devel] [Wok][PATCH v2 6/7] Multi-Culture support : Modify wok.formatMeasurement util to include formatting based on locale
pkulkark at linux.vnet.ibm.com
pkulkark at linux.vnet.ibm.com
Thu May 5 07:02:28 UTC 2016
From: Pooja Kulkarni <pkulkark at linux.vnet.ibm.com>
co-authored by: Archana Singh <archus at linux.vnet.ibm.com>
This patch modifies the wok.formatMeasurement util
to include formatting based on locale passed, in
wok.utils.js
Signed-off-by: Pooja Kulkarni <pkulkark at linux.vnet.ibm.com>
---
ui/js/src/wok.utils.js | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/ui/js/src/wok.utils.js b/ui/js/src/wok.utils.js
index 214749a..d198c37 100644
--- a/ui/js/src/wok.utils.js
+++ b/ui/js/src/wok.utils.js
@@ -140,6 +140,8 @@ wok.changetoProperUnit = function(numOrg, digits, base) {
return new Formatted(number, unit);
}
+ var n_locale = settings['locale'] || null;
+
var fixed = settings['fixed'];
var unitMapping = unitBaseMapping[base];
@@ -153,11 +155,13 @@ wok.changetoProperUnit = function(numOrg, digits, base) {
var formatted = number / startingValue;
formatted = fixed ? formatted.toFixed(fixed) : formatted;
-
+ formatted = n_locale ? Number(formatted).toLocaleString(n_locale) : Number(formatted).toLocaleString()
return new Formatted(formatted, suffix + unit);
}
-
- return new Formatted(fixed ? number.toFixed(fixed) : number, unit);
+ var formatted = 0;
+ formatted = fixed ? formatted.toFixed(fixed) : formatted;
+ formatted = n_locale ? Number(formatted).toLocaleString(n_locale) : Number(formatted).toLocaleString()
+ return new Formatted(formatted, unit);
};
wok.formatMeasurement = format;
--
2.1.0
More information about the Kimchi-devel
mailing list