Bug 1544489 use separate strings to localize install prompt for unknown sites. r=flod,aswan

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Shane Caraveo 2019-04-29 19:00:55 +00:00
Родитель ebc5efc1e9
Коммит 174c8d6c4d
2 изменённых файлов: 18 добавлений и 12 удалений

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

@ -414,9 +414,13 @@ var gXPInstallObserver = {
removeNotificationOnEnd(popup, installInfo.installs);
break; }
case "addon-install-blocked": {
messageString = gNavigatorBundle.getFormattedString("xpinstallPromptMessage.header", ["<>"]);
let unknown = gNavigatorBundle.getString("xpinstallPromptMessage.unknown");
options.name = options.displayURI && options.displayURI.displayHost || unknown;
let hasHost = !!options.displayURI;
if (hasHost) {
messageString = gNavigatorBundle.getFormattedString("xpinstallPromptMessage.header", ["<>"]);
options.name = options.displayURI.displayHost;
} else {
messageString = gNavigatorBundle.getString("xpinstallPromptMessage.header.unknown");
}
// displayURI becomes it's own label, so we unset it for this panel. It will become part of the
// messageString above.
options.displayURI = undefined;
@ -431,11 +435,15 @@ var gXPInstallObserver = {
while (message.firstChild) {
message.firstChild.remove();
}
let text = gNavigatorBundle.getString("xpinstallPromptMessage.message");
let b = doc.createElementNS("http://www.w3.org/1999/xhtml", "b");
b.textContent = options.name;
let fragment = BrowserUtils.getLocalizedFragment(doc, text, b);
message.appendChild(fragment);
if (hasHost) {
let text = gNavigatorBundle.getString("xpinstallPromptMessage.message");
let b = doc.createElementNS("http://www.w3.org/1999/xhtml", "b");
b.textContent = options.name;
let fragment = BrowserUtils.getLocalizedFragment(doc, text, b);
message.appendChild(fragment);
} else {
message.textContent = gNavigatorBundle.getString("xpinstallPromptMessage.message.unknown");
}
let learnMore = doc.getElementById("addon-install-blocked-info");
learnMore.textContent = gNavigatorBundle.getString("xpinstallPromptMessage.learnMore");
learnMore.setAttribute("href", Services.urlFormatter.formatURLPref("app.support.baseURL") + "unlisted-extensions-risks");

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

@ -25,10 +25,8 @@ xpinstallPromptMessage=%S prevented this site from asking you to install softwar
# The string contains the hostname of the site the add-on is being installed from.
xpinstallPromptMessage.header=Allow %S to install an add-on?
xpinstallPromptMessage.message=You are attempting to install an add-on from %S. Make sure you trust this site before continuing.
# LOCALIZATION NOTE (xpinstallPromptMessage.unknown)
# This string is used in xpinstallPromptMessage.header and xpinstallPromptMessage.message when the domain is not available,
# for example in case of local installs with drag and drop.
xpinstallPromptMessage.unknown=an unknown site
xpinstallPromptMessage.header.unknown=Allow an unknown site to install an add-on?
xpinstallPromptMessage.message.unknown=You are attempting to install an add-on from an unknown site. Make sure you trust this site before continuing.
xpinstallPromptMessage.learnMore=Learn more about installing add-ons safely
xpinstallPromptMessage.dontAllow=Dont Allow
xpinstallPromptMessage.dontAllow.accesskey=D