Bug 1449505 - Migrate translation-infobar to use mozIntl.getLocaleDisplayNames. r=jfkthame

MozReview-Commit-ID: I3aK212eJtE

--HG--
extra : rebase_source : 20e2d409842e6e84e8b81eecf59f9c8a38f8d4dc
This commit is contained in:
Zibi Braniecki 2018-04-01 14:54:53 +02:00
Родитель 9c1cb5c6f0
Коммит feab1b148f
1 изменённых файлов: 4 добавлений и 5 удалений

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

@ -182,9 +182,10 @@
<body>
<![CDATA[
this.translation = aTranslation;
let bundle = Services.strings.createBundle("chrome://global/locale/languageNames.properties");
let sortByLocalizedName = function(aList) {
return aList.map(code => [code, bundle.GetStringFromName(code)])
let names = Services.intl.getLanguageDisplayNames(undefined, aList);
return aList.map((code, i) => [code, names[i]])
.sort((a, b) => a[1].localeCompare(b[1]));
};
@ -355,9 +356,7 @@
lang = this.translation.detectedLanguage;
}
let langBundle =
Services.strings.createBundle("chrome://global/locale/languageNames.properties");
let langName = langBundle.GetStringFromName(lang);
let langName = Services.intl.getLanguageDisplayNames(undefined, [lang])[0];
// Set the label and accesskey on the menuitem.
let bundle =