Bug 726863 - Use mobile-specific strings for add-on download error messages [r=mfinkle]

This commit is contained in:
Matt Brubeck 2012-02-14 15:32:45 -08:00
Родитель 0ee3f559fe
Коммит fdc1aea807
2 изменённых файлов: 36 добавлений и 15 удалений

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

@ -144,8 +144,7 @@ var Strings = {};
[
["brand", "chrome://branding/locale/brand.properties"],
["browser", "chrome://browser/locale/browser.properties"],
["charset", "chrome://global/locale/charsetTitles.properties"],
["ext", "chrome://mozapps/locale/extensions/extensions.properties"]
["charset", "chrome://global/locale/charsetTitles.properties"]
].forEach(function (aStringBundle) {
let [name, bundle] = aStringBundle;
XPCOMUtils.defineLazyGetter(Strings, name, function() {
@ -3077,21 +3076,27 @@ var XPInstallObserver = {
},
onDownloadCancelled: function(aInstall) {
let addon = aInstall.addon;
if (!addon)
return;
let host = (aInstall.originatingURI instanceof Ci.nsIStandardURL) && aInstall.originatingURI.host;
if (!host)
host = (aInstall.sourceURI instanceof Ci.nsIStandardURL) && aInstall.sourceURI.host;
let msg;
let error = (host || aInstall.error == 0) ? "addonError" : "addonLocalError";
if (aInstall.error != 0)
error += aInstall.error;
else if (aInstall.addon && aInstall.addon.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED)
error += "Blocklisted";
else if (aInstall.addon && (!aInstall.addon.isCompatible || !aInstall.addon.isPlatformCompatible))
error += "Incompatible";
else
return; // No need to show anything in this case.
if (addon.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED) {
msg = gStrings.ext.formatStringFromName("details.notification.blocked", [aInstall.name], 1);
} else if (!addon.isCompatible || !addon.isPlatformCompatible) {
let brandShortName = Strings.brand.GetStringFromName("brandShortName");
msg = Strings.ext.formatStringFromName("details.notification.incompatible",
[aInstall.name, brandShortName, Services.appinfo.version], 3);
} else {
msg = Strings.ext.formatStringFromName("notification.downloadError", [aInstall.name], 1);
}
let msg = Strings.browser.GetStringFromName(error);
// TODO: formatStringFromName
msg = msg.replace("#1", aInstall.name);
if (host)
msg = msg.replace("#2", host);
msg = msg.replace("#3", Strings.brand.GetStringFromName("brandShortName"));
msg = msg.replace("#4", Services.appinfo.version);
NativeWindow.toast.show(msg, "short");
}

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

@ -22,6 +22,22 @@ alertFullScreenToast=Press BACK to leave full-screen mode
downloadCancelPromptTitle=Cancel Download
downloadCancelPromptMessage=Do you want to cancel this download?
# LOCALIZATION NOTE (addonError-1, addonError-2, addonError-3, addonError-4):
# #1 is the add-on name, #2 is the add-on host, #3 is the application name
addonError-1=The add-on could not be downloaded because of a connection failure on #2.
addonError-2=The add-on from #2 could not be installed because it does not match the add-on #3 expected.
addonError-3=The add-on downloaded from #2 could not be installed because it appears to be corrupt.
addonError-4=#1 could not be installed because #3 cannot modify the needed file.
# LOCALIZATION NOTE (addonLocalError-1, addonLocalError-2, addonLocalError-3, addonLocalError-4, addonErrorIncompatible, addonErrorBlocklisted):
# #1 is the add-on name, #3 is the application name, #4 is the application version
addonLocalError-1=This add-on could not be installed because of a filesystem error.
addonLocalError-2=This add-on could not be installed because it does not match the add-on #3 expected.
addonLocalError-3=This add-on could not be installed because it appears to be corrupt.
addonLocalError-4=#1 could not be installed because #3 cannot modify the needed file.
addonErrorIncompatible=#1 could not be installed because it is not compatible with #3 #4.
addonErrorBlocklisted=#1 could not be installed because it has a high risk of causing stability or security problems.
# Notifications
notificationRestart.normal=Restart to complete changes.
notificationRestart.update=Add-ons updated. Restart to complete changes.