Bug 1491676 - Moves download folder strings r=flod,Gijs,zbraniecki
☠☠ backed out by b5e996a1d34b ☠ ☠
authorJack Smith <jack@jackdeansmith.com>
Mon, 05 Nov 2018 16:59:02 +0000
changeset 444836 04b83b7977c4875f8e7da73feb6c4306c1b4e056
parent 444835 eb19b384d908980abc0a36d3bda1158c95e97563
child 444837 e860d0d115d04d12cbc60723c40cd38671305946
push id72512
push usergijskruitbosch@gmail.com
push dateWed, 07 Nov 2018 10:22:47 +0000
treeherderautoland@e860d0d115d0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflod, Gijs, zbraniecki
bugs1491676
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1491676 - Moves download folder strings r=flod,Gijs,zbraniecki Depends on D8554 Differential Revision: https://phabricator.services.mozilla.com/D8928
browser/components/preferences/in-content/main.js
browser/locales/en-US/browser/preferences/preferences.ftl
browser/locales/en-US/chrome/browser/preferences/preferences.properties
python/l10n/fluent_migrations/bug_1491676_preferences_properties.py
--- a/browser/components/preferences/in-content/main.js
+++ b/browser/components/preferences/in-content/main.js
@@ -2250,17 +2250,17 @@ var gMainPane = {
    * Displays a file picker in which the user can choose the location where
    * downloads are automatically saved, updating preferences and UI in
    * response to the choice, if one is made.
    */
   chooseFolder() {
     return this.chooseFolderTask().catch(Cu.reportError);
   },
   async chooseFolderTask() {
-    let title = gMainPane._prefsBundle.getString("chooseDownloadFolderTitle");
+    let [title] = await document.l10n.formatValues([{id: "choose-download-folder-title"}]);
     let folderListPref = Preferences.get("browser.download.folderList");
     let currentDirPref = await this._indexToFolder(folderListPref.value);
     let defDownloads = await this._indexToFolder(1);
     let fp = Cc["@mozilla.org/filepicker;1"].
       createInstance(Ci.nsIFilePicker);
 
     fp.init(window, title, Ci.nsIFilePicker.modeGetFolder);
     fp.appendFilters(Ci.nsIFilePicker.filterAll);
@@ -2315,28 +2315,29 @@ var gMainPane = {
       // When user has selected cloud storage, use value in currentDirPref to
       // compute index to display download folder label and icon to avoid
       // displaying blank downloadFolder label and icon on load of preferences UI
       // Set folderIndex to 1 if currentDirPref is unspecified
       folderIndex = currentDirPref.value ? await this._folderToIndex(currentDirPref.value) : 1;
     }
 
     // Display a 'pretty' label or the path in the UI.
+    // note: downloadFolder.value is not read elsewhere in the code, its only purpose is to display to the user
     if (folderIndex == 2) {
       // Force the left-to-right direction when displaying a custom path.
       downloadFolder.value = currentDirPref.value ?
         `\u2066${currentDirPref.value.path}\u2069` : "";
       iconUrlSpec = fph.getURLSpecFromFile(currentDirPref.value);
     } else if (folderIndex == 1) {
       // 'Downloads'
-      downloadFolder.value = gMainPane._prefsBundle.getString("downloadsFolderName");
+      [downloadFolder.value] = await document.l10n.formatValues([{id: "downloads-folder-name"}]);
       iconUrlSpec = fph.getURLSpecFromFile(await this._indexToFolder(1));
     } else {
       // 'Desktop'
-      downloadFolder.value = gMainPane._prefsBundle.getString("desktopFolderName");
+      [downloadFolder.value] = await document.l10n.formatValues([{id: "desktop-folder-name"}]);
       iconUrlSpec = fph.getURLSpecFromFile(await this._getDownloadsFolder("Desktop"));
     }
     downloadFolder.style.backgroundImage = "url(moz-icon://" + iconUrlSpec + "?size=16)";
   },
 
   /**
    * Returns the Downloads folder.  If aFolder is "Desktop", then the Downloads
    * folder returned is the desktop folder; otherwise, it is a folder whose name
--- a/browser/locales/en-US/browser/preferences/preferences.ftl
+++ b/browser/locales/en-US/browser/preferences/preferences.ftl
@@ -1033,12 +1033,17 @@ space-alert-over-5gb-message =
     }
 
 space-alert-under-5gb-ok-button =
     .label = OK, Got it
     .accesskey = K
 
 space-alert-under-5gb-message = { -brand-short-name } is running out of disk space. Website contents may not display properly. Visit “Learn More” to optimize your disk usage for better browsing experience.
 
+## The following strings are used in the Download section of settings
+desktop-folder-name = Desktop
+downloads-folder-name = Downloads
+choose-download-folder-title = Choose Download Folder:
+
 # Variables:
 #   $service-name (String) - Name of a cloud storage provider like Dropbox, Google Drive, etc...
 save-files-to-cloud-storage =
     .label = Save files to { $service-name }
--- a/browser/locales/en-US/chrome/browser/preferences/preferences.properties
+++ b/browser/locales/en-US/chrome/browser/preferences/preferences.properties
@@ -2,22 +2,16 @@
 # 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/.
 
 #### Master Password
 
 pw_change2empty_in_fips_mode=You are currently in FIPS mode. FIPS requires a non-empty Master Password.
 pw_change_failed_title=Password Change Failed
 
-#### Downloads
-
-desktopFolderName=Desktop
-downloadsFolderName=Downloads
-chooseDownloadFolderTitle=Choose Download Folder:
-
 #### Applications
 
 fileEnding=%S file
 saveFile=Save File
 
 # LOCALIZATION NOTE (useApp, useDefault): %S = Application name
 useApp=Use %S
 useDefault=Use %S (default)
--- a/python/l10n/fluent_migrations/bug_1491676_preferences_properties.py
+++ b/python/l10n/fluent_migrations/bug_1491676_preferences_properties.py
@@ -39,16 +39,19 @@ pw-remove-button =
         transforms_from(
             """
 space-alert-learn-more-button =
         .label = { COPY(from_path, "spaceAlert.learnMoreButton.label")}
         .accesskey = { COPY(from_path, "spaceAlert.learnMoreButton.accesskey")}
 space-alert-under-5gb-ok-button =
         .label = { COPY(from_path, "spaceAlert.under5GB.okButton.label")}
         .accesskey = { COPY(from_path, "spaceAlert.under5GB.okButton.accesskey")}
+desktop-folder-name = { COPY(from_path, "desktopFolderName")}
+downloads-folder-name = { COPY(from_path, "downloadsFolderName")}
+choose-download-folder-title = { COPY(from_path, "chooseDownloadFolderTitle")}
 """, from_path="browser/chrome/browser/preferences/preferences.properties"))
 
     ctx.add_transforms(
         "browser/browser/preferences/preferences.ftl",
         "browser/browser/preferences/preferences.ftl",
         [
             FTL.Message(
                 id=FTL.Identifier("space-alert-under-5gb-message"),