Bug 1457948 - Migrate in-content/privacy.js to Fluent. r?jaws,flod draft
authorZibi Braniecki <zbraniecki@mozilla.com>
Mon, 30 Apr 2018 10:29:18 -0700
changeset 792311 3e8efddac1d9b3b5e56198cd777eca2e5647cd7b
parent 792270 59005ba3cd3e7b3f9e8804bea881bf4c3a755d7c
push id109080
push userbmo:gandalf@aviary.pl
push dateTue, 08 May 2018 07:52:32 +0000
reviewersjaws, flod
bugs1457948
milestone62.0a1
Bug 1457948 - Migrate in-content/privacy.js to Fluent. r?jaws,flod MozReview-Commit-ID: 7K7Wgm5ahTL
browser/components/preferences/in-content/privacy.js
browser/components/preferences/in-content/privacy.xul
browser/components/preferences/permissions.js
browser/components/preferences/sitePermissions.js
browser/components/preferences/sitePermissions.xul
browser/locales/en-US/browser/preferences/permissions.ftl
browser/locales/en-US/chrome/browser/preferences/preferences.properties
python/l10n/fluent_migrations/bug_1457948_incontent_privacy_js.py
--- a/browser/components/preferences/in-content/privacy.js
+++ b/browser/components/preferences/in-content/privacy.js
@@ -381,62 +381,19 @@ var gPrivacyPane = {
       }
       this.initSubmitHealthReport();
       setEventListener("submitHealthReportBox", "command",
         gPrivacyPane.updateSubmitHealthReport);
     }
     this._initA11yState();
     let signonBundle = document.getElementById("signonBundle");
     let pkiBundle = document.getElementById("pkiBundle");
-    appendSearchKeywords("passwordExceptions", [
-      bundlePrefs.getString("savedLoginsExceptions_title"),
-      bundlePrefs.getString("savedLoginsExceptions_desc3"),
-    ]);
     appendSearchKeywords("showPasswords", [
       signonBundle.getString("loginsDescriptionAll2"),
     ]);
-    appendSearchKeywords("cookieExceptions", [
-      bundlePrefs.getString("cookiepermissionstext1"),
-    ]);
-    appendSearchKeywords("trackingProtectionExceptions", [
-      bundlePrefs.getString("trackingprotectionpermissionstitle"),
-      bundlePrefs.getString("trackingprotectionpermissionstext2"),
-    ]);
-    appendSearchKeywords("popupPolicyButton", [
-      bundlePrefs.getString("popuppermissionstitle2"),
-      bundlePrefs.getString("popuppermissionstext"),
-    ]);
-    appendSearchKeywords("notificationSettingsButton", [
-      bundlePrefs.getString("notificationspermissionstitle2"),
-      bundlePrefs.getString("notificationspermissionstext6"),
-      bundlePrefs.getString("notificationspermissionsdisablelabel"),
-      bundlePrefs.getString("notificationspermissionsdisabledescription"),
-    ]);
-    appendSearchKeywords("locationSettingsButton", [
-      bundlePrefs.getString("locationpermissionstitle"),
-      bundlePrefs.getString("locationpermissionstext2"),
-      bundlePrefs.getString("locationpermissionsdisablelabel"),
-      bundlePrefs.getString("locationpermissionsdisabledescription"),
-    ]);
-    appendSearchKeywords("cameraSettingsButton", [
-      bundlePrefs.getString("camerapermissionstitle"),
-      bundlePrefs.getString("camerapermissionstext2"),
-      bundlePrefs.getString("camerapermissionsdisablelabel"),
-      bundlePrefs.getString("camerapermissionsdisabledescription"),
-    ]);
-    appendSearchKeywords("microphoneSettingsButton", [
-      bundlePrefs.getString("microphonepermissionstitle"),
-      bundlePrefs.getString("microphonepermissionstext2"),
-      bundlePrefs.getString("microphonepermissionsdisablelabel"),
-      bundlePrefs.getString("microphonepermissionsdisabledescription"),
-    ]);
-    appendSearchKeywords("addonExceptions", [
-      bundlePrefs.getString("addons_permissions_title2"),
-      bundlePrefs.getString("addonspermissionstext"),
-    ]);
     appendSearchKeywords("viewSecurityDevicesButton", [
       pkiBundle.getString("enable_fips"),
     ]);
     appendSearchKeywords("siteDataSettings", [
       bundlePrefs.getString("siteDataSettings3.description"),
       bundlePrefs.getString("removeAllSiteData.label"),
     ]);
 
@@ -769,22 +726,19 @@ var gPrivacyPane = {
 
     this._shouldPromptForRestart = true;
   },
 
   /**
    * Displays fine-grained, per-site preferences for tracking protection.
    */
   showTrackingProtectionExceptions() {
-    let bundlePreferences = document.getElementById("bundlePreferences");
     let params = {
       permissionType: "trackingprotection",
       hideStatusColumn: true,
-      windowTitle: bundlePreferences.getString("trackingprotectionpermissionstitle"),
-      introText: bundlePreferences.getString("trackingprotectionpermissionstext2"),
     };
     gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
       null, params);
   },
 
   /**
    * Displays the available block lists for tracking protection.
    */
@@ -903,25 +857,22 @@ var gPrivacyPane = {
         return undefined;
     }
   },
 
   /**
    * Displays fine-grained, per-site preferences for cookies.
    */
   showCookieExceptions() {
-    var bundlePreferences = document.getElementById("bundlePreferences");
     var params = {
       blockVisible: true,
       sessionVisible: true,
       allowVisible: true,
       prefilledHost: "",
       permissionType: "cookie",
-      windowTitle: bundlePreferences.getString("cookiepermissionstitle1"),
-      introText: bundlePreferences.getString("cookiepermissionstext1")
     };
     gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
       null, params);
   },
 
   showSiteDataSettings() {
     gSubDialog.open("chrome://browser/content/preferences/siteDataSettings.xul");
   },
@@ -955,76 +906,56 @@ var gPrivacyPane = {
 
   // GEOLOCATION
 
   /**
    * Displays the location exceptions dialog where specific site location
    * preferences can be set.
    */
   showLocationExceptions() {
-    let bundlePreferences = document.getElementById("bundlePreferences");
     let params = { permissionType: "geo" };
-    params.windowTitle = bundlePreferences.getString("locationpermissionstitle");
-    params.introText = bundlePreferences.getString("locationpermissionstext2");
-    params.disablePermissionsLabel = bundlePreferences.getString("locationpermissionsdisablelabel");
-    params.disablePermissionsDescription = bundlePreferences.getString("locationpermissionsdisabledescription");
 
     gSubDialog.open("chrome://browser/content/preferences/sitePermissions.xul",
       "resizable=yes", params);
   },
 
   // CAMERA
 
   /**
    * Displays the camera exceptions dialog where specific site camera
    * preferences can be set.
    */
   showCameraExceptions() {
-    let bundlePreferences = document.getElementById("bundlePreferences");
     let params = { permissionType: "camera" };
-    params.windowTitle = bundlePreferences.getString("camerapermissionstitle");
-    params.introText = bundlePreferences.getString("camerapermissionstext2");
-    params.disablePermissionsLabel = bundlePreferences.getString("camerapermissionsdisablelabel");
-    params.disablePermissionsDescription = bundlePreferences.getString("camerapermissionsdisabledescription");
 
     gSubDialog.open("chrome://browser/content/preferences/sitePermissions.xul",
       "resizable=yes", params);
   },
 
   // MICROPHONE
 
   /**
    * Displays the microphone exceptions dialog where specific site microphone
    * preferences can be set.
    */
   showMicrophoneExceptions() {
-    let bundlePreferences = document.getElementById("bundlePreferences");
     let params = { permissionType: "microphone" };
-    params.windowTitle = bundlePreferences.getString("microphonepermissionstitle");
-    params.introText = bundlePreferences.getString("microphonepermissionstext2");
-    params.disablePermissionsLabel = bundlePreferences.getString("microphonepermissionsdisablelabel");
-    params.disablePermissionsDescription = bundlePreferences.getString("microphonepermissionsdisabledescription");
 
     gSubDialog.open("chrome://browser/content/preferences/sitePermissions.xul",
       "resizable=yes", params);
   },
 
   // NOTIFICATIONS
 
   /**
    * Displays the notifications exceptions dialog where specific site notification
    * preferences can be set.
    */
   showNotificationExceptions() {
-    let bundlePreferences = document.getElementById("bundlePreferences");
     let params = { permissionType: "desktop-notification" };
-    params.windowTitle = bundlePreferences.getString("notificationspermissionstitle2");
-    params.introText = bundlePreferences.getString("notificationspermissionstext6");
-    params.disablePermissionsLabel = bundlePreferences.getString("notificationspermissionsdisablelabel");
-    params.disablePermissionsDescription = bundlePreferences.getString("notificationspermissionsdisabledescription");
 
     gSubDialog.open("chrome://browser/content/preferences/sitePermissions.xul",
       "resizable=yes", params);
 
     try {
       Services.telemetry
         .getHistogramById("WEB_NOTIFICATION_EXCEPTIONS_OPENED").add();
     } catch (e) { }
@@ -1033,23 +964,20 @@ var gPrivacyPane = {
 
   // POP-UPS
 
   /**
    * Displays the popup exceptions dialog where specific site popup preferences
    * can be set.
    */
   showPopupExceptions() {
-    var bundlePreferences = document.getElementById("bundlePreferences");
     var params = {
       blockVisible: false, sessionVisible: false, allowVisible: true,
       prefilledHost: "", permissionType: "popup"
     };
-    params.windowTitle = bundlePreferences.getString("popuppermissionstitle2");
-    params.introText = bundlePreferences.getString("popuppermissionstext");
 
     gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
       "resizable=yes", params);
   },
 
   // UTILITY FUNCTIONS
 
   /**
@@ -1074,26 +1002,23 @@ var gPrivacyPane = {
 
   // POP-UPS
 
   /**
    * Displays a dialog in which the user can view and modify the list of sites
    * where passwords are never saved.
    */
   showPasswordExceptions() {
-    var bundlePrefs = document.getElementById("bundlePreferences");
     var params = {
       blockVisible: true,
       sessionVisible: false,
       allowVisible: false,
       hideStatusColumn: true,
       prefilledHost: "",
       permissionType: "login-saving",
-      windowTitle: bundlePrefs.getString("savedLoginsExceptions_title"),
-      introText: bundlePrefs.getString("savedLoginsExceptions_desc3")
     };
 
     gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
       null, params);
   },
 
   /**
    * Initializes master password UI: the "use master password" checkbox, selects
@@ -1307,23 +1232,17 @@ var gPrivacyPane = {
 
     blockUncommonUnwanted.checked = blockUnwantedPref.value && blockUncommonPref.value;
   },
 
   /**
    * Displays the exceptions lists for add-on installation warnings.
    */
   showAddonExceptions() {
-    var bundlePrefs = document.getElementById("bundlePreferences");
-
     var params = this._addonParams;
-    if (!params.windowTitle || !params.introText) {
-      params.windowTitle = bundlePrefs.getString("addons_permissions_title2");
-      params.introText = bundlePrefs.getString("addonspermissionstext");
-    }
 
     gSubDialog.open("chrome://browser/content/preferences/permissions.xul",
       null, params);
   },
 
   /**
    * Parameters for the add-on install permissions dialog.
    */
--- a/browser/components/preferences/in-content/privacy.xul
+++ b/browser/components/preferences/in-content/privacy.xul
@@ -28,17 +28,21 @@
                 onsyncfrompreference="return gPrivacyPane.readSavePasswords();"
                 flex="1" />
       <!-- Please don't remove the wrapping hbox/vbox/box for these elements. It's used to properly compute the search tooltip position. -->
       <hbox>
         <button id="passwordExceptions"
                 class="accessory-button"
                 data-l10n-id="forms-exceptions"
                 preference="pref.privacy.disable_button.view_passwords_exceptions"
-                search-l10n-ids="permissions-address"/>
+                search-l10n-ids="
+                  permissions-address,
+                  permissions-exceptions-saved-logins-window.title,
+                  permissions-exceptions-saved-logins-desc,
+                "/>
       </hbox>
     </hbox>
     <hbox id="showPasswordBox" pack="end">
       <!-- Please don't remove the wrapping hbox/vbox/box for these elements. It's used to properly compute the search tooltip position. -->
       <hbox>
         <button id="showPasswords"
                 class="accessory-button"
                 data-l10n-id="forms-saved-logins"
@@ -245,17 +249,18 @@
                 preference="pref.privacy.disable_button.cookie_exceptions"
                 search-l10n-ids="
                   permissions-address,
                   permissions-block.label,
                   permissions-allow.label,
                   permissions-remove.label,
                   permissions-remove-all.label,
                   permissions-button-cancel.label,
-                  permissions-button-ok.label
+                  permissions-button-ok.label,
+                  permissions-exceptions-cookie-desc,
                 " />
       </hbox>
     </vbox>
   </hbox>
 </groupbox>
 
 <!-- Address Bar -->
 <groupbox id="locationBarGroup"
@@ -334,17 +339,19 @@
                   flex="1"
                   hidden="true"
                   data-l10n-id="tracking-exceptions"
                   preference="pref.privacy.disable_button.tracking_protection_exceptions"
                   search-l10n-ids="
                     permissions-remove.label,
                     permissions-remove-all.label,
                     permissions-button-cancel.label,
-                    permissions-button-ok.label
+                    permissions-button-ok.label,
+                    permissions-exceptions-tracking-protection-window.title,
+                    permissions-exceptions-tracking-protection-desc,
                   "/>
         </hbox>
         <!-- Please don't remove the wrapping hbox/vbox/box for these elements. It's used to properly compute the search tooltip position. -->
         <hbox>
           <button id="changeBlockList"
                   class="accessory-button"
                   flex="1"
                   data-l10n-id="tracking-change-block-list"
@@ -392,16 +399,20 @@
           <button id="locationSettingsButton"
                   class="accessory-button"
                   data-l10n-id="permissions-location-settings"
                   search-l10n-ids="
                     permissions-remove.label,
                     permissions-remove-all.label,
                     permissions-button-cancel.label,
                     permissions-button-ok.label,
+                    permissions-site-location-window.title,
+                    permissions-site-location-desc,
+                    permissions-site-location-disable-label,
+                    permissions-site-location-disable-desc,
                   " />
         </hbox>
       </row>
 
       <row id="cameraSettingsRow" align="center">
         <description flex="1">
           <image class="camera-icon permission-icon" />
           <separator orient="vertical" class="thin"/>
@@ -411,16 +422,20 @@
           <button id="cameraSettingsButton"
                   class="accessory-button"
                   data-l10n-id="permissions-camera-settings"
                   search-l10n-ids="
                     permissions-remove.label,
                     permissions-remove-all.label,
                     permissions-button-cancel.label,
                     permissions-button-ok.label,
+                    permissions-site-camera-window.title,
+                    permissions-site-camera-desc,
+                    permissions-site-camera-disable-label,
+                    permissions-site-camera-disable-desc,
                   " />
         </hbox>
       </row>
 
       <row id="microphoneSettingsRow" align="center">
         <description flex="1">
           <image class="microphone-icon permission-icon" />
           <separator orient="vertical" class="thin"/>
@@ -430,16 +445,20 @@
           <button id="microphoneSettingsButton"
                   class="accessory-button"
                   data-l10n-id="permissions-microphone-settings"
                   search-l10n-ids="
                     permissions-remove.label,
                     permissions-remove-all.label,
                     permissions-button-cancel.label,
                     permissions-button-ok.label,
+                    permissions-site-microphone-window.title,
+                    permissions-site-microphone-desc,
+                    permissions-site-microphone-disable-label,
+                    permissions-site-microphone-disable-desc,
                   " />
         </hbox>
       </row>
 
       <row id="notificationSettingsRow" align="center">
         <description flex="1">
           <image class="desktop-notification-icon permission-icon" />
           <separator orient="vertical" class="thin"/>
@@ -454,16 +473,20 @@
           <button id="notificationSettingsButton"
                   class="accessory-button"
                   data-l10n-id="permissions-notification-settings"
                   search-l10n-ids="
                     permissions-remove.label,
                     permissions-remove-all.label,
                     permissions-button-cancel.label,
                     permissions-button-ok.label,
+                    permissions-site-notification-window.title,
+                    permissions-site-notification-desc,
+                    permissions-site-notification-disable-label,
+                    permissions-site-notification-disable-desc,
                   " />
         </hbox>
       </row>
     </rows>
   </grid>
 
   <vbox id="notificationsDoNotDisturbBox" hidden="true">
     <checkbox id="notificationsDoNotDisturb" class="indent"/>
@@ -480,17 +503,19 @@
     <!-- Please don't remove the wrapping hbox/vbox/box for these elements. It's used to properly compute the search tooltip position. -->
     <hbox>
       <button id="popupPolicyButton"
               class="accessory-button"
               data-l10n-id="permissions-block-popups-exceptions"
               search-l10n-ids="
                 permissions-address,
                 permissions-button-cancel.label,
-                permissions-button-ok.label
+                permissions-button-ok.label,
+                permissions-exceptions-popup-window.title,
+                permissions-exceptions-popup-desc,
               " />
     </hbox>
   </hbox>
 
   <hbox id="addonInstallBox">
     <checkbox id="warnAddonInstall"
               data-l10n-id="permissions-addon-install-warning"
               preference="xpinstall.whitelist.required"
@@ -503,16 +528,18 @@
               data-l10n-id="permissions-addon-exceptions"
               search-l10n-ids="
                 permissions-address,
                 permissions-allow.label,
                 permissions-remove.label,
                 permissions-remove-all.label,
                 permissions-button-cancel.label,
                 permissions-button-ok.label,
+                permissions-exceptions-addons-window.title,
+                permissions-exceptions-addons-desc,
               " />
     </hbox>
   </hbox>
 
   <vbox id="a11yPermissionsBox">
     <hbox flex="1" align="center">
       <checkbox id="a11yPrivacyCheckbox" class="tail-with-learn-more"
                 data-l10n-id="permissions-a11y-privacy-checkbox"
--- a/browser/components/preferences/permissions.js
+++ b/browser/components/preferences/permissions.js
@@ -8,16 +8,39 @@
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 
 const nsIPermissionManager = Ci.nsIPermissionManager;
 const nsICookiePermission = Ci.nsICookiePermission;
 
 const NOTIFICATION_FLUSH_PERMISSIONS = "flush-pending-permissions";
 
+const permissionExceptionsL10n = {
+  "trackingprotection": {
+    window: "permissions-exceptions-tracking-protection-window",
+    description: "permissions-exceptions-tracking-protection-desc",
+  },
+  "cookie": {
+    window: "permissions-exceptions-cookie-window",
+    description: "permissions-exceptions-cookie-desc",
+  },
+  "popup": {
+    window: "permissions-exceptions-popup-window",
+    description: "permissions-exceptions-popup-desc",
+  },
+  "login-saving": {
+    window: "permissions-exceptions-saved-logins-window",
+    description: "permissions-exceptions-saved-logins-desc",
+  },
+  "install": {
+    window: "permissions-exceptions-addons-window",
+    description: "permissions-exceptions-addons-desc",
+  },
+};
+
 function Permission(principal, type, capability) {
   this.principal = principal;
   this.origin = principal.origin;
   this.type = type;
   this.capability = capability;
 }
 
 var gPermissionManager = {
@@ -99,19 +122,22 @@ var gPermissionManager = {
         }
       } catch (ex) {
         uri = Services.io.newURI("http://" + input_url);
         principal = Services.scriptSecurityManager.createCodebasePrincipal(uri, {});
         // If we have ended up with an unknown scheme, the following will throw.
         principal.origin;
       }
     } catch (ex) {
-      var message = this._bundle.getString("invalidURI");
-      var title = this._bundle.getString("invalidURITitle");
-      Services.prompt.alert(window, title, message);
+      document.l10n.formatValues([
+        ["permissions-invalid-uri-title"],
+        ["permissions-invalid-uri-label"]
+      ]).then(([message, title]) => {
+        Services.prompt.alert(window, title, message);
+      });
       return;
     }
 
     var capabilityString = this._getCapabilityString(aCapability);
 
     // check whether the permission already exists, if not, add it
     let permissionExists = false;
     let capabilityExists = false;
@@ -199,32 +225,38 @@ var gPermissionManager = {
   onHostKeyPress(aEvent) {
     if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN)
       document.getElementById("btnAllow").click();
   },
 
   onLoad() {
     this._bundle = document.getElementById("bundlePreferences");
     var params = window.arguments[0];
-    this.init(params);
+    document.mozSubdialogReady = this.init(params);
   },
 
-  init(aParams) {
+  async init(aParams) {
     if (this._type) {
       // reusing an open dialog, clear the old observer
       this.uninit();
     }
 
     this._type = aParams.permissionType;
     this._manageCapability = aParams.manageCapability;
 
+    const l10n = permissionExceptionsL10n[this._type];
     let permissionsText = document.getElementById("permissionsText");
-    permissionsText.textContent = aParams.introText;
+    document.l10n.setAttributes(permissionsText, l10n.description);
+
+    document.l10n.setAttributes(document.documentElement, l10n.window);
 
-    document.title = aParams.windowTitle;
+    await document.l10n.translateElements([
+      document.documentElement,
+      permissionsText,
+    ]);
 
     document.getElementById("btnBlock").hidden    = !aParams.blockVisible;
     document.getElementById("btnSession").hidden  = !aParams.sessionVisible;
     document.getElementById("btnAllow").hidden    = !aParams.allowVisible;
 
     var urlFieldVisible = (aParams.blockVisible || aParams.sessionVisible || aParams.allowVisible);
 
     var urlField = document.getElementById("url");
--- a/browser/components/preferences/sitePermissions.js
+++ b/browser/components/preferences/sitePermissions.js
@@ -1,16 +1,43 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 ChromeUtils.import("resource://gre/modules/Services.jsm");
 ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 ChromeUtils.import("resource:///modules/SitePermissions.jsm");
 
+const sitePermissionsL10n = {
+  "desktop-notification": {
+    window: "permissions-site-notification-window",
+    description: "permissions-site-notification-desc",
+    disableLabel: "permissions-site-notification-disable-label",
+    disableDescription: "permissions-site-notification-disable-desc",
+  },
+  "geo": {
+    window: "permissions-site-location-window",
+    description: "permissions-site-location-desc",
+    disableLabel: "permissions-site-location-disable-label",
+    disableDescription: "permissions-site-location-disable-desc",
+  },
+  "camera": {
+    window: "permissions-site-camera-window",
+    description: "permissions-site-camera-desc",
+    disableLabel: "permissions-site-camera-disable-label",
+    disableDescription: "permissions-site-camera-disable-desc",
+  },
+  "microphone": {
+    window: "permissions-site-microphone-window",
+    description: "permissions-site-microphone-desc",
+    disableLabel: "permissions-site-microphone-disable-label",
+    disableDescription: "permissions-site-microphone-disable-desc",
+  },
+};
+
 function Permission(principal, type, capability, capabilityString) {
   this.principal = principal;
   this.origin = principal.origin;
   this.type = type;
   this.capability = capability;
   this.capabilityString = capabilityString;
 }
 
@@ -28,43 +55,48 @@ var gSitePermissionsManager = {
   _removeAllButton: null,
   _searchBox: null,
   _checkbox: null,
   _currentDefaultPermissionsState: null,
   _defaultPermissionStatePrefName: null,
 
   onLoad() {
     let params = window.arguments[0];
-    this.init(params);
+    document.mozSubdialogReady = this.init(params);
   },
 
-  init(params) {
+  async init(params) {
     if (!this._isObserving) {
       Services.obs.addObserver(this, "perm-changed");
       this._isObserving = true;
     }
 
     this._bundle = document.getElementById("bundlePreferences");
     this._type = params.permissionType;
     this._list = document.getElementById("permissionsBox");
     this._removeButton = document.getElementById("removePermission");
     this._removeAllButton = document.getElementById("removeAllPermissions");
     this._searchBox = document.getElementById("searchBox");
     this._checkbox = document.getElementById("permissionsDisableCheckbox");
 
+    let permissionsDisableDescription = document.getElementById("permissionsDisableDescription");
     let permissionsText = document.getElementById("permissionsText");
-    permissionsText.textContent = params.introText;
-
-
 
-    this._checkbox.setAttribute("label", params.disablePermissionsLabel);
-    let permissionsDisableDescription = document.getElementById("permissionsDisableDescription");
-    permissionsDisableDescription.appendChild(document.createTextNode(params.disablePermissionsDescription));
+    const l10n = sitePermissionsL10n[this._type];
+    document.l10n.setAttributes(permissionsText, l10n.description);
+    document.l10n.setAttributes(this._checkbox, l10n.disableLabel);
+    document.l10n.setAttributes(permissionsDisableDescription, l10n.disableDescription);
+    document.l10n.setAttributes(document.documentElement, l10n.window);
 
-    document.title = params.windowTitle;
+    await document.l10n.translateElements([
+      permissionsText,
+      this._checkbox,
+      permissionsDisableDescription,
+      document.documentElement,
+    ]);
 
     // Initialize the checkbox state.
     this._defaultPermissionStatePrefName = "permissions.default." + this._type;
     let pref = Services.prefs.getPrefType(this._defaultPermissionStatePrefName);
     if (pref != Services.prefs.PREF_INVALID) {
       this._currentDefaultPermissionsState = Services.prefs.getIntPref(this._defaultPermissionStatePrefName);
     }
 
--- a/browser/components/preferences/sitePermissions.xul
+++ b/browser/components/preferences/sitePermissions.xul
@@ -7,17 +7,17 @@
 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
 <?xml-stylesheet href="chrome://browser/content/preferences/sitePermissions.css" type="text/css"?>
 <?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?>
 
 <window id="SitePermissionsDialog" class="windowDialog"
         windowtype="Browser:SitePermissions"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         data-l10n-id="permissions-window"
-        data-l10n-attrs="style"
+        data-l10n-attrs="title, style"
         onload="gSitePermissionsManager.onLoad();"
         onunload="gSitePermissionsManager.uninit();"
         persist="screenX screenY width height"
         onkeypress="gSitePermissionsManager.onWindowKeyPress(event);">
 
   <link rel="localization" href="browser/preferences/permissions.ftl"/>
   <script type="application/javascript" src="chrome://global/content/l10n.js"></script>
 
--- a/browser/locales/en-US/browser/preferences/permissions.ftl
+++ b/browser/locales/en-US/browser/preferences/permissions.ftl
@@ -43,8 +43,89 @@ permissions-button-cancel =
     .accesskey = C
 
 permissions-button-ok =
     .label = Save Changes
     .accesskey = S
 
 permissions-searchbox =
     .placeholder = Search Website
+
+
+## Invalid Hostname Dialog
+
+permissions-invalid-uri-title = Invalid Hostname Entered
+permissions-invalid-uri-label = Please enter a valid hostname
+
+## Exceptions - Tracking Protection
+
+permissions-exceptions-tracking-protection-window =
+    .title = Exceptions - Tracking Protection
+    .style = { permissions-window.style }
+permissions-exceptions-tracking-protection-desc = You have disabled Tracking Protection on these websites.
+
+## Exceptions - Cookies
+
+permissions-exceptions-cookie-window =
+    .title = Exceptions - Cookies and Site Data
+    .style = { permissions-window.style }
+permissions-exceptions-cookie-desc = You can specify which websites are always or never allowed to use cookies and site data.  Type the exact address of the site you want to manage and then click Block, Allow for Session, or Allow.
+
+## Exceptions - Pop-ups
+
+permissions-exceptions-popup-window =
+    .title = Allowed Websites - Pop-ups
+    .style = { permissions-window.style }
+permissions-exceptions-popup-desc = You can specify which websites are allowed to open pop-up windows. Type the exact address of the site you want to allow and then click Allow.
+
+## Exceptions - Saved Logins
+
+permissions-exceptions-saved-logins-window =
+    .title = Exceptions - Saved Logins
+    .style = { permissions-window.style }
+permissions-exceptions-saved-logins-desc = Logins for the following websites will not be saved
+
+## Exceptions - Add-ons
+
+permissions-exceptions-addons-window =
+    .title = Allowed Websites - Add-ons Installation
+    .style = { permissions-window.style }
+permissions-exceptions-addons-desc = You can specify which websites are allowed to install add-ons. Type the exact address of the site you want to allow and then click Allow.
+
+## Site Permissions - Notifications
+
+permissions-site-notification-window =
+    .title = Settings - Notification Permissions
+    .style = { permissions-window.style }
+permissions-site-notification-desc = The following websites have requested to send you notifications. You can specify which websites are allowed to send you notifications. You can also block new requests asking to allow notifications.
+permissions-site-notification-disable-label =
+    .label = Block new requests asking to allow notifications
+permissions-site-notification-disable-desc = This will prevent any websites not listed above from requesting permission to send notifications. Blocking notifications may break some website features.
+
+## Site Permissions - Location
+
+permissions-site-location-window =
+    .title = Settings - Location Permissions
+    .style = { permissions-window.style }
+permissions-site-location-desc = The following websites have requested to access your location. You can specify which websites are allowed to access your location. You can also block new requests asking to access your location.
+permissions-site-location-disable-label =
+    .label = Block new requests asking to access your location
+permissions-site-location-disable-desc = This will prevent any websites not listed above from requesting permission to access your location. Blocking access to your location may break some website features.
+
+## Site Permissions - Camera
+
+permissions-site-camera-window =
+    .title = Settings - Camera Permissions
+    .style = { permissions-window.style }
+permissions-site-camera-desc = The following websites have requested to access your camera. You can specify which websites are allowed to access your camera. You can also block new requests asking to access your camera.
+permissions-site-camera-disable-label =
+    .label = Block new requests asking to access your camera
+permissions-site-camera-disable-desc = This will prevent any websites not listed above from requesting permission to access your camera. Blocking access to your camera may break some website features.
+
+## Site Permissions - Microphone
+
+permissions-site-microphone-window =
+    .title = Settings - Microphone Permissions
+    .style = { permissions-window.style }
+permissions-site-microphone-desc = The following websites have requested to access your microphone. You can specify which websites are allowed to access your microphone. You can also block new requests asking to access your microphone.
+permissions-site-microphone-disable-label =
+    .label = Block new requests asking to access your microphone
+permissions-site-microphone-disable-desc = This will prevent any websites not listed above from requesting permission to access your microphone. Blocking access to your microphone may break some website features.
--- a/browser/locales/en-US/chrome/browser/preferences/preferences.properties
+++ b/browser/locales/en-US/chrome/browser/preferences/preferences.properties
@@ -13,47 +13,16 @@ phishBeforeText=Selecting this option wi
 
 labelDefaultFont=Default (%S)
 labelDefaultFontUnnamed=Default
 
 veryLargeMinimumFontTitle=Large minimum font size
 veryLargeMinimumFontWarning=You have selected a very large minimum font size (more than 24 pixels). This may make it difficult or impossible to use some important configuration pages like this one.
 acceptVeryLargeMinimumFont=Keep my changes anyway
 
-#### Permissions Manager
-
-trackingprotectionpermissionstext2=You have disabled Tracking Protection on these websites.
-trackingprotectionpermissionstitle=Exceptions - Tracking Protection
-cookiepermissionstext1=You can specify which websites are always or never allowed to use cookies and site data.  Type the exact address of the site you want to manage and then click Block, Allow for Session, or Allow.
-cookiepermissionstitle1=Exceptions - Cookies and Site Data
-addonspermissionstext=You can specify which websites are allowed to install add-ons. Type the exact address of the site you want to allow and then click Allow.
-addons_permissions_title2=Allowed Websites - Add-ons Installation
-popuppermissionstext=You can specify which websites are allowed to open pop-up windows. Type the exact address of the site you want to allow and then click Allow.
-popuppermissionstitle2=Allowed Websites - Pop-ups
-notificationspermissionstext6=The following websites have requested to send you notifications. You can specify which websites are allowed to send you notifications. You can also block new requests asking to allow notifications.
-notificationspermissionstitle2=Settings - Notification Permissions
-notificationspermissionsdisablelabel=Block new requests asking to allow notifications
-notificationspermissionsdisabledescription=This will prevent any websites not listed above from requesting permission to send notifications. Blocking notifications may break some website features.
-locationpermissionstext2=The following websites have requested to access your location. You can specify which websites are allowed to access your location. You can also block new requests asking to access your location.
-locationpermissionstitle=Settings - Location Permissions
-locationpermissionsdisablelabel=Block new requests asking to access your location
-locationpermissionsdisabledescription=This will prevent any websites not listed above from requesting permission to access your location. Blocking access to your location may break some website features.
-camerapermissionstext2=The following websites have requested to access your camera. You can specify which websites are allowed to access your camera. You can also block new requests asking to access your camera.
-camerapermissionstitle=Settings - Camera Permissions
-camerapermissionsdisablelabel=Block new requests asking to access your camera
-camerapermissionsdisabledescription=This will prevent any websites not listed above from requesting permission to access your camera. Blocking access to your camera may break some website features.
-microphonepermissionstext2=The following websites have requested to access your microphone. You can specify which websites are allowed to access your microphone. You can also block new requests asking to access your microphone.
-microphonepermissionstitle=Settings - Microphone Permissions
-microphonepermissionsdisablelabel=Block new requests asking to access your microphone
-microphonepermissionsdisabledescription=This will prevent any websites not listed above from requesting permission to access your microphone. Blocking access to your microphone may break some website features.
-invalidURI=Please enter a valid hostname
-invalidURITitle=Invalid Hostname Entered
-savedLoginsExceptions_title=Exceptions - Saved Logins
-savedLoginsExceptions_desc3=Logins for the following websites will not be saved
-
 #### Block List Manager
 
 # LOCALIZATION NOTE (mozNameTemplate): This template constructs the name of the
 # block list in the block lists dialog. It combines the list name and
 # description.
 #   e.g. mozNameTemplate : "Standard (Recommended). This list does a pretty good job."
 #   %1$S = list name (fooName), %2$S = list descriptive text (fooDesc)
 mozNameTemplate=%1$S %2$S
new file mode 100644
--- /dev/null
+++ b/python/l10n/fluent_migrations/bug_1457948_incontent_privacy_js.py
@@ -0,0 +1,72 @@
+# coding=utf8
+
+# Any copyright is dedicated to the Public Domain.
+# http://creativecommons.org/publicdomain/zero/1.0/
+
+from __future__ import absolute_import
+import fluent.syntax.ast as FTL
+from fluent.migrate.helpers import transforms_from
+# from fluent.migrate.helpers import MESSAGE_REFERENCE, EXTERNAL_ARGUMENT, transforms_from
+# from fluent.migrate import COPY, CONCAT, REPLACE
+
+
+def migrate(ctx):
+    """Bug 1457948 - Migrate in-content/privacy.js to Fluent, part {index}."""
+
+    ctx.add_transforms(
+        'browser/browser/preferences/permissions.ftl',
+        'browser/browser/preferences/permissions.ftl',
+        transforms_from(
+"""
+permissions-invalid-uri-title = { COPY("browser/chrome/browser/preferences/preferences.properties", "invalidURITitle") }
+permissions-invalid-uri-label = { COPY("browser/chrome/browser/preferences/preferences.properties", "invalidURI") }
+permissions-exceptions-tracking-protection-window =
+    .title = { COPY("browser/chrome/browser/preferences/preferences.properties", "trackingprotectionpermissionstitle") }
+    .style = { permissions-window.style }
+permissions-exceptions-tracking-protection-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "trackingprotectionpermissionstext2") }
+permissions-exceptions-cookie-window =
+    .title = { COPY("browser/chrome/browser/preferences/preferences.properties", "cookiepermissionstitle1") }
+    .style = { permissions-window.style }
+permissions-exceptions-cookie-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "cookiepermissionstext1") }
+permissions-exceptions-popup-window =
+    .title = { COPY("browser/chrome/browser/preferences/preferences.properties", "popuppermissionstitle2") }
+    .style = { permissions-window.style }
+permissions-exceptions-popup-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "popuppermissionstext") }
+permissions-exceptions-saved-logins-window =
+    .title = { COPY("browser/chrome/browser/preferences/preferences.properties", "savedLoginsExceptions_title") }
+    .style = { permissions-window.style }
+permissions-exceptions-saved-logins-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "savedLoginsExceptions_desc3") }
+permissions-exceptions-addons-window =
+    .title = { COPY("browser/chrome/browser/preferences/preferences.properties", "addons_permissions_title2") }
+    .style = { permissions-window.style }
+permissions-exceptions-addons-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "addonspermissionstext") }
+permissions-site-notification-window =
+    .title = { COPY("browser/chrome/browser/preferences/preferences.properties", "notificationspermissionstitle2") }
+    .style = { permissions-window.style }
+permissions-site-notification-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "notificationspermissionstext6") }
+permissions-site-notification-disable-label =
+    .label = { COPY("browser/chrome/browser/preferences/preferences.properties", "notificationspermissionsdisablelabel") }
+permissions-site-notification-disable-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "notificationspermissionsdisabledescription") }
+permissions-site-location-window =
+    .title = { COPY("browser/chrome/browser/preferences/preferences.properties", "locationpermissionstitle") }
+    .style = { permissions-window.style }
+permissions-site-location-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "locationpermissionstext2") }
+permissions-site-location-disable-label =
+    .label = { COPY("browser/chrome/browser/preferences/preferences.properties", "locationpermissionsdisablelabel") }
+permissions-site-location-disable-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "locationpermissionsdisabledescription") }
+permissions-site-camera-window =
+    .title = { COPY("browser/chrome/browser/preferences/preferences.properties", "camerapermissionstitle") }
+    .style = { permissions-window.style }
+permissions-site-camera-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "camerapermissionstext2") }
+permissions-site-camera-disable-label =
+    .label = { COPY("browser/chrome/browser/preferences/preferences.properties", "camerapermissionsdisablelabel") }
+permissions-site-camera-disable-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "camerapermissionsdisabledescription") }
+permissions-site-microphone-window =
+    .title = { COPY("browser/chrome/browser/preferences/preferences.properties", "microphonepermissionstitle") }
+    .style = { permissions-window.style }
+permissions-site-microphone-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "microphonepermissionstext2") }
+permissions-site-microphone-disable-label =
+    .label = { COPY("browser/chrome/browser/preferences/preferences.properties", "microphonepermissionsdisablelabel") }
+permissions-site-microphone-disable-desc = { COPY("browser/chrome/browser/preferences/preferences.properties", "microphonepermissionsdisabledescription") }
+""")
+    )