Bug 1507595 - Use data-l10n-id instead of formatValue where the change is relatively straightforward. r=Gijs

Differential Revision: https://phabricator.services.mozilla.com/D14906

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jared Wein 2018-12-28 19:40:20 +00:00
Родитель 4f86678a71
Коммит 00ad040a3a
1 изменённых файлов: 23 добавлений и 20 удалений

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

@ -86,29 +86,32 @@ var snapshotFormatters = {
} }
if (Services.policies) { if (Services.policies) {
let policiesText = ""; let policiesStrId = "";
let aboutPolicies = "about:policies"; let aboutPolicies = "about:policies";
switch (data.policiesStatus) { switch (data.policiesStatus) {
case Services.policies.INACTIVE: case Services.policies.INACTIVE:
policiesText = await document.l10n.formatValue("policies-inactive"); policiesStrId = "policies-inactive";
break; break;
case Services.policies.ACTIVE: case Services.policies.ACTIVE:
policiesText = await document.l10n.formatValue("policies-active"); policiesStrId = "policies-active";
aboutPolicies += "#active"; aboutPolicies += "#active";
break; break;
default: default:
policiesText = await document.l10n.formatValue("policies-error"); policiesStrId = "policies-error";
aboutPolicies += "#errors"; aboutPolicies += "#errors";
break; break;
} }
if (data.policiesStatus != Services.policies.INACTIVE) { if (data.policiesStatus != Services.policies.INACTIVE) {
let activePolicies = $.new("a", policiesText, null, {href: aboutPolicies}); let activePolicies = $.new("a", null, null, {
"data-l10n-id": policiesStrId,
href: aboutPolicies,
});
$("policies-status").appendChild(activePolicies); $("policies-status").appendChild(activePolicies);
} else { } else {
$("policies-status").textContent = policiesText; document.l10n.setAttributes($("policies-status"), policiesStrId);
} }
} else { } else {
$("policies-status-row").hidden = true; $("policies-status-row").hidden = true;
@ -587,16 +590,16 @@ var snapshotFormatters = {
} }
}, },
async media(data) { media(data) {
async function insertBasicInfo(key, value) { function insertBasicInfo(key, value) {
async function createRow(key, value) { function createRow(key, value) {
let th = $.new("th", await document.l10n.formatValue(key), "column"); let th = $.new("th", null, "column", {"data-l10n-id": key});
let td = $.new("td", value); let td = $.new("td", value);
td.style["white-space"] = "pre-wrap"; td.style["white-space"] = "pre-wrap";
td.colSpan = 8; td.colSpan = 8;
return $.new("tr", [th, td]); return $.new("tr", [th, td]);
} }
$.append($("media-info-tbody"), [await createRow(key, value)]); $.append($("media-info-tbody"), [createRow(key, value)]);
} }
function createDeviceInfoRow(device) { function createDeviceInfoRow(device) {
@ -679,9 +682,9 @@ var snapshotFormatters = {
} }
// Basic information // Basic information
await insertBasicInfo("audio-backend", data.currentAudioBackend); insertBasicInfo("audio-backend", data.currentAudioBackend);
await insertBasicInfo("max-audio-channels", data.currentMaxAudioChannels); insertBasicInfo("max-audio-channels", data.currentMaxAudioChannels);
await insertBasicInfo("sample-rate", data.currentPreferredSampleRate); insertBasicInfo("sample-rate", data.currentPreferredSampleRate);
// Output devices information // Output devices information
insertDeviceInfo("output", data.audioOutputDevices); insertDeviceInfo("output", data.audioOutputDevices);
@ -709,12 +712,12 @@ var snapshotFormatters = {
} }
}, },
async libraryVersions(data) { libraryVersions(data) {
let trs = [ let trs = [
$.new("tr", [ $.new("tr", [
$.new("th", ""), $.new("th", ""),
$.new("th", await document.l10n.formatValue("min-lib-versions")), $.new("th", null, null, {"data-l10n-id": "min-lib-versions"}),
$.new("th", await document.l10n.formatValue("loaded-lib-versions")), $.new("th", null, null, {"data-l10n-id": "loaded-lib-versions"}),
]), ]),
]; ];
sortedArrayFromObject(data).forEach( sortedArrayFromObject(data).forEach(
@ -740,7 +743,7 @@ var snapshotFormatters = {
$("prefs-user-js-section").className = ""; $("prefs-user-js-section").className = "";
}, },
async sandbox(data) { sandbox(data) {
if (!AppConstants.MOZ_SANDBOX) if (!AppConstants.MOZ_SANDBOX)
return; return;
@ -757,7 +760,7 @@ var snapshotFormatters = {
} }
let keyStrId = toFluentID(key); let keyStrId = toFluentID(key);
tbody.appendChild($.new("tr", [ tbody.appendChild($.new("tr", [
$.new("th", await document.l10n.formatValue(keyStrId), "column"), $.new("th", null, "column", {"data-l10n-id": keyStrId}),
$.new("td", data[key]), $.new("td", data[key]),
])); ]));
} }
@ -775,7 +778,7 @@ var snapshotFormatters = {
$.new("td", syscall.msecAgo / 1000), $.new("td", syscall.msecAgo / 1000),
$.new("td", syscall.pid, "integer"), $.new("td", syscall.pid, "integer"),
$.new("td", syscall.tid, "integer"), $.new("td", syscall.tid, "integer"),
$.new("td", await document.l10n.formatValue("sandbox-proc-type-" + procTypeStrId)), $.new("td", null, null, {"data-l10n-id": "sandbox-proc-type-" + procTypeStrId}),
$.new("td", syscall.syscall, "integer"), $.new("td", syscall.syscall, "integer"),
]; ];
for (let arg of syscall.args) { for (let arg of syscall.args) {