Bug 1201232 - Use Services.intl for Intl.* APIs in Gecko. r?Paolo,pike
It's a minor change that should align us better with our selection of locales
(Services.intl will use user selection of regional preference locales).
I also removed the western arabic numeral system limitation to allow persian locales
to use eastern arabic numerals correctly.
MozReview-Commit-ID: 8TXX0X9RY9z
--- a/toolkit/components/narrate/NarrateControls.jsm
+++ b/toolkit/components/narrate/NarrateControls.jsm
@@ -160,18 +160,17 @@ NarrateControls.prototype = {
* Returns true if synth voices are available.
*/
_setupVoices() {
return this._languagePromise.then(language => {
this.voiceSelect.clear();
let win = this._win;
let voicePrefs = this._getVoicePref();
let selectedVoice = voicePrefs[language || "default"];
- let comparer = win.Intl ?
- (new Intl.Collator()).compare : (a, b) => a.localeCompare(b);
+ let comparer = (new Services.intl.Collator()).compare;
let filter = !Services.prefs.getBoolPref("narrate.filter-voices");
let options = win.speechSynthesis.getVoices().filter(v => {
return filter || !language || v.lang.split("-")[0] == language;
}).map(v => {
return {
label: this._createVoiceLabel(v),
value: v.voiceURI,
selected: selectedVoice == v.voiceURI
--- a/toolkit/mozapps/downloads/DownloadUtils.jsm
+++ b/toolkit/mozapps/downloads/DownloadUtils.jsm
@@ -46,27 +46,23 @@ Cu.import("resource://gre/modules/Servic
XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
"resource://gre/modules/PluralForm.jsm");
const MS_PER_DAY = 24 * 60 * 60 * 1000;
var localeNumberFormatCache = new Map();
function getLocaleNumberFormat(fractionDigits) {
- // Backward compatibility: don't use localized digits
- let locale = Intl.NumberFormat().resolvedOptions().locale +
- "-u-nu-latn";
- let key = locale + "_" + fractionDigits;
- if (!localeNumberFormatCache.has(key)) {
- localeNumberFormatCache.set(key,
- Intl.NumberFormat(locale,
+ if (!localeNumberFormatCache.has(fractionDigits)) {
+ localeNumberFormatCache.set(fractionDigits,
+ new Services.intl.NumberFormat(undefined,
{ maximumFractionDigits: fractionDigits,
minimumFractionDigits: fractionDigits }));
}
- return localeNumberFormatCache.get(key);
+ return localeNumberFormatCache.get(fractionDigits);
}
const kDownloadProperties =
"chrome://mozapps/locale/downloads/downloads.properties";
var gStr = {
statusFormat: "statusFormat3",
statusFormatInfiniteRate: "statusFormatInfiniteRate",