Infocatcher / Link_Properties_Plus

Provides extended link properties: size of linked file, last modified time, etc., extension for Firefox, SeaMonkey and Thunderbird
https://addons.mozilla.org/addon/link-properties-plus/
Other
10 stars 3 forks source link

Localization of numbers format may not work correctly in some locales #15

Closed Infocatcher closed 9 years ago

Infocatcher commented 10 years ago

Due to https://bugzilla.mozilla.org/show_bug.cgi?id=999003, "Number.toLocaleString() without locale returns localized digits specified by the OS"

https://github.com/Infocatcher/Link_Properties_Plus/blob/1.5.2/chrome/content/linkPropsPlus.js#L983-L994

In resource://gre/modules/DownloadUtils.jsm:

this.__defineGetter__("gDecimalSymbol", function() {
  delete this.gDecimalSymbol;
  return this.gDecimalSymbol = Number(5.4).toLocaleString().match(/\D/);
});

(from Firefox 33.0a1 (2014-06-25), also see https://bugzilla.mozilla.org/show_bug.cgi?id=1009795)

Anyway, our implementation is better: will be used 123 456.78, if localized numbers doesn't contain digits.

Infocatcher commented 10 years ago

Secret preferences:

See description in defaults/preferences/prefs.js:

Locales for numbers and dates (Firefox 29+):
"" - use OS locale
"<browser>" - use browser locale (navigator.language)
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation