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

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: Fixing parsing of numberFormat 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 | no next file » | 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..de4f18cd9528e08136b3d4e1ec1092ce4c915b76 100644
--- a/chrome/browser/resources/print_preview/margin_settings.js
+++ b/chrome/browser/resources/print_preview/margin_settings.js
@@ -167,16 +167,16 @@ 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,
- * sent from the backend.
+ * @param {string} numberFormat Is the formatted version of the sample number
+ * 12345678 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
* third_party/icu/public/i18n/unicode/ulocdata.h.
*/
MarginSettings.setNumberFormatAndMeasurementSystem = function(
numberFormat, measurementSystem) {
- var regex = /^(\d+)(\.|\,)(\d+)(\.|\,)(\d+)$/;
- var matches = numberFormat.match(regex);
+ var regex = /^(123)(\W{0,1})(456)(\W{0,1})(78)$/;
+ var matches = numberFormat.match(regex) || ['','','.','',','];
dpapad 2011/12/12 23:58:06 The fix has 2 parts. 1) Changing the regex to all
Lei Zhang 2011/12/13 00:16:02 Isn't this reversed? ',' for thousands and '.' for
dpapad1 2011/12/13 01:01:19 Well, I am not sure what the fallback should be. I
dpapad1 2011/12/13 01:11:32 Done.
MarginSettings.thousandsPoint = matches[2];
MarginSettings.decimalPoint = matches[4];
MarginSettings.useMetricSystem = measurementSystem == 0;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698