mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-23 18:26:15 +00:00
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 --HG-- extra : rebase_source : a7c8f507d841945e47f2d4cc142b4b05bbfab08f
This commit is contained in:
parent
5d9f2162cb
commit
e4b89607c0
@ -165,8 +165,7 @@ NarrateControls.prototype = {
|
||||
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;
|
||||
|
@ -51,17 +51,13 @@ 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 =
|
||||
|
Loading…
Reference in New Issue
Block a user