Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1894)

Unified Diff: chrome/browser/resources/print_preview/margin_settings.js

Issue 8922021: Print Preview: Fixing parsing of numberFormat for several locales. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changed fallback format Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/print_preview_utils.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/print_preview/margin_settings.js
diff --git a/chrome/browser/resources/print_preview/margin_settings.js b/chrome/browser/resources/print_preview/margin_settings.js
index 3e9063986ab8db1c1a27369f3e707982682890c2..bd81d705491a8747b1ada137e2ecf13a31bc0fdb 100644
--- a/chrome/browser/resources/print_preview/margin_settings.js
+++ b/chrome/browser/resources/print_preview/margin_settings.js
@@ -167,7 +167,7 @@ cr.define('print_preview', function() {
/**
* Extracts the number formatting and measurement system for the current
* locale.
- * @param {string} numberFormat Is the formatted version of a sample number,
+ * @param {string} numberFormat Is the formatted version of a sample number
* sent from the backend.
* @param {number} measurementSystem 0 for SI (aka metric system), 1 for the
* system used in the US. Note: Mathces UMeasurementSystem enum in
@@ -175,10 +175,9 @@ cr.define('print_preview', function() {
*/
MarginSettings.setNumberFormatAndMeasurementSystem = function(
numberFormat, measurementSystem) {
- var regex = /^(\d+)(\.|\,)(\d+)(\.|\,)(\d+)$/;
- var matches = numberFormat.match(regex);
- MarginSettings.thousandsPoint = matches[2];
- MarginSettings.decimalPoint = matches[4];
+ var symbols = parseNumberFormat(numberFormat);
+ MarginSettings.thousandsPoint = symbols[0];
+ MarginSettings.decimalPoint = symbols[1];
MarginSettings.useMetricSystem = measurementSystem == 0;
};
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/print_preview_utils.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698