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

MozReview-Commit-ID: I3aK212eJtE

--HG--
extra : rebase_source : f63cd206f4f5cd7005f9270a1de25a83d79197c4
This commit is contained in:
Zibi Braniecki 2018-04-01 14:54:53 +02:00
Родитель b5a3eb8225
Коммит 958538de36
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 =