Bug 1340618 - Don't hardcode Firefox in strings for space disk warning in Preferences draft
authorFischer.json <fischer.json@gmail.com>
Mon, 20 Feb 2017 11:57:13 +0800
changeset 486859 375654054285c68717d3cbb2d537414786311646
parent 486741 16effd5b21ab03629feca04b5b83911bb757394c
child 546336 641fa23aebc2618dc1a77a748e8a1bdf39b97bd3
push id46081
push userbmo:fliu@mozilla.com
push dateMon, 20 Feb 2017 04:14:03 +0000
bugs1340618
milestone54.0a1
Bug 1340618 - Don't hardcode Firefox in strings for space disk warning in Preferences MozReview-Commit-ID: KyEba2v30rC
browser/base/content/browser.js
browser/locales/en-US/chrome/browser/preferences/preferences.properties
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -455,48 +455,49 @@ const gStoragePressureObserver = {
 
     const BYTES_IN_GIGABYTE = 1073741824;
     const USAGE_THRESHOLD_BYTES = BYTES_IN_GIGABYTE *
       Services.prefs.getIntPref("browser.storageManager.pressureNotification.usageThresholdGB");
     let msg = "";
     let buttons = [];
     let usage = parseInt(data);
     let prefStrBundle = document.getElementById("bundle_preferences");
+    let brandShortName = document.getElementById("bundle_brand").getString("brandShortName");
     let notificationBox = document.getElementById("high-priority-global-notificationbox");
     buttons.push({
       label: prefStrBundle.getString("spaceAlert.learnMoreButton.label"),
       accessKey: prefStrBundle.getString("spaceAlert.learnMoreButton.accesskey"),
       callback(notificationBar, button) {
         let learnMoreURL = Services.urlFormatter.formatURLPref("app.support.baseURL") + "storage-permissions";
         gBrowser.selectedTab = gBrowser.addTab(learnMoreURL);
       }
     });
     if (usage < USAGE_THRESHOLD_BYTES) {
       // The firefox-used space < 5GB, then warn user to free some disk space.
       // This is because this usage is small and not the main cause for space issue.
       // In order to avoid the bad and wrong impression among users that
       // firefox eats disk space a lot, indicate users to clean up other disk space.
-      msg = prefStrBundle.getString("spaceAlert.under5GB.description");
+      msg = prefStrBundle.getFormattedString("spaceAlert.under5GB.message", [brandShortName]);
       buttons.push({
         label: prefStrBundle.getString("spaceAlert.under5GB.okButton.label"),
         accessKey: prefStrBundle.getString("spaceAlert.under5GB.okButton.accesskey"),
         callback() {}
       });
     } else {
       // The firefox-used space >= 5GB, then guide users to about:preferences
       // to clear some data stored on firefox by websites.
-      let descriptionStringID = "spaceAlert.over5GB.description";
+      let descriptionStringID = "spaceAlert.over5GB.message";
       let prefButtonLabelStringID = "spaceAlert.over5GB.prefButton.label";
       let prefButtonAccesskeyStringID = "spaceAlert.over5GB.prefButton.accesskey";
       if (AppConstants.platform == "win") {
-        descriptionStringID = "spaceAlert.over5GB.descriptionWin";
+        descriptionStringID = "spaceAlert.over5GB.messageWin";
         prefButtonLabelStringID = "spaceAlert.over5GB.prefButtonWin.label";
         prefButtonAccesskeyStringID = "spaceAlert.over5GB.prefButtonWin.accesskey";
       }
-      msg = prefStrBundle.getString(descriptionStringID);
+      msg = prefStrBundle.getFormattedString(descriptionStringID, [brandShortName]);
       buttons.push({
         label: prefStrBundle.getString(prefButtonLabelStringID),
         accessKey: prefStrBundle.getString(prefButtonAccesskeyStringID),
         callback(notificationBar, button) {
           gBrowser.ownerGlobal.openPreferences("advanced", { advancedTab: "networkTab" });
         }
       });
     }
--- a/browser/locales/en-US/chrome/browser/preferences/preferences.properties
+++ b/browser/locales/en-US/chrome/browser/preferences/preferences.properties
@@ -202,22 +202,26 @@ removeAllSiteDataShown.label=Remove All 
 removeAllSiteDataShown.accesskey=e
 spaceAlert.learnMoreButton.label=Learn More
 spaceAlert.learnMoreButton.accesskey=L
 spaceAlert.over5GB.prefButton.label=Open Preferences
 spaceAlert.over5GB.prefButton.accesskey=O
 # LOCALIZATION NOTE (spaceAlert.over5GB.prefButtonWin.label): On Windows Preferences is called Options
 spaceAlert.over5GB.prefButtonWin.label=Open Options
 spaceAlert.over5GB.prefButtonWin.accesskey=O
-spaceAlert.over5GB.description=Firefox is running out of disk space. Website contents may not display properly. You can clear stored site data in Preferences > Advanced > Site Data.
-# LOCALIZATION NOTE (spaceAlert.over5GB.descriptionWin): On Windows Preferences is called Options
-spaceAlert.over5GB.descriptionWin=Firefox is running out of disk space. Website contents may not display properly. You can clear stored site data in Options > Advanced > Site Data.
+# LOCALIZATION NOTE (spaceAlert.over5GB.message): %S = brandShortName
+spaceAlert.over5GB.message=%S is running out of disk space. Website contents may not display properly. You can clear stored site data in Preferences > Advanced > Site Data.
+# LOCALIZATION NOTE (spaceAlert.over5GB.messageWin):
+# - On Windows Preferences is called Options
+# - %S = brandShortName
+spaceAlert.over5GB.messageWin=%S is running out of disk space. Website contents may not display properly. You can clear stored site data in Options > Advanced > Site Data.
 spaceAlert.under5GB.okButton.label=OK, Got it
 spaceAlert.under5GB.okButton.accesskey=K
-spaceAlert.under5GB.description=Firefox is running out of disk space. Website contents may not display properly. Visit “Learn More” to optimize your disk usage for better browsing experience.
+# LOCALIZATION NOTE (spaceAlert.under5GB.message): %S = brandShortName
+spaceAlert.under5GB.message=%S is running out of disk space. Website contents may not display properly. Visit “Learn More” to optimize your disk usage for better browsing experience.
 
 # LOCALIZATION NOTE (featureEnableRequiresRestart, featureDisableRequiresRestart, restartTitle): %S = brandShortName
 featureEnableRequiresRestart=%S must restart to enable this feature.
 featureDisableRequiresRestart=%S must restart to disable this feature.
 shouldRestartTitle=Restart %S
 okToRestartButton=Restart %S now
 revertNoRestartButton=Revert