Bug 1370086 - [DateTimePicker] Ensure calendar type is Gregorian for all locales. r=gandalf,mconley

MozReview-Commit-ID: H7kPn2bdEhP

--HG--
extra : rebase_source : 0c36a0a9ea79d97375a2ebd506ec8ca880ff881d
This commit is contained in:
Scott Wu 2017-07-17 14:31:45 +08:00
Родитель e99e36dd18
Коммит 9313aeafa2
1 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -109,7 +109,9 @@
<method name="initPicker">
<parameter name="detail"/>
<body><![CDATA[
const locale = Services.locale.getAppLocaleAsBCP47();
// TODO: When bug 1376616 lands, replace this.setGregorian with
// mozIntl.Locale for setting calendar to Gregorian
const locale = this.setGregorian(Services.locale.getAppLocaleAsBCP47());
const dir = this.mozIntl.getLocaleInfo(locale).direction;
switch (this.type) {
@ -279,6 +281,15 @@
return keys.map(key => displayNames.values[key]);
]]></body>
</method>
<method name="setGregorian">
<parameter name="locale"/>
<body><![CDATA[
if (locale.match(/u-ca-/)) {
return locale.replace(/u-ca-[^-]+/, "u-ca-gregory");
}
return locale + "-u-ca-gregory";
]]></body>
</method>
<method name="handleEvent">
<parameter name="aEvent"/>
<body><![CDATA[