Bug 1336434 - "Your Top Sites" heading should say "Top Sites" instead when using the default set. r?gijs draft
authorDão Gottwald <dao@mozilla.com>
Tue, 14 Feb 2017 12:39:11 +0100
changeset 483482 325413e56dbc56ddd2c1fafe5d4fe1480ead640d
parent 482882 e1a4314f8e6eae8bbc06394c14132a9c5011371b
child 545654 963ba057bf24925d63d81697e6e36dbb2fa4f7fa
push id45327
push userdgottwald@mozilla.com
push dateTue, 14 Feb 2017 11:40:51 +0000
reviewersgijs
bugs1336434
milestone54.0a1
Bug 1336434 - "Your Top Sites" heading should say "Top Sites" instead when using the default set. r?gijs MozReview-Commit-ID: 3TXSxKSqgJy
browser/base/content/newtab/grid.js
browser/base/content/newtab/newTab.xhtml
browser/locales/en-US/chrome/browser/newTab.dtd
browser/locales/en-US/chrome/browser/newTab.properties
--- a/browser/base/content/newtab/grid.js
+++ b/browser/base/content/newtab/grid.js
@@ -137,27 +137,34 @@ var gGrid = {
     // Create cells.
     let cells = Array.from(fragment.childNodes, (cell) => new Cell(this, cell));
 
     // Fetch links.
     let links = gLinks.getLinks();
 
     // Create sites.
     let numLinks = Math.min(links.length, cells.length);
+    let hasHistoryTiles = false;
     for (let i = 0; i < numLinks; i++) {
       if (links[i]) {
         this.createSite(links[i], cells[i]);
+        if (links[i].type == "history") {
+          hasHistoryTiles = true;
+        }
       }
     }
 
     this._cells = cells;
     while (this._gridDefaultContent.nextSibling) {
       this._gridDefaultContent.nextSibling.remove();
     }
     this._node.appendChild(fragment);
+
+    document.getElementById("topsites-heading").textContent =
+      newTabString(hasHistoryTiles ? "userTopSites.heading" : "defaultTopSites.heading");
   },
 
   /**
    * Calculate the height for a number of rows up to the maximum rows
    * @param rows Number of rows defaulting to the max
    */
   _computeHeight: function Grid_computeHeight(aRows) {
     let {gridRows} = gGridPrefs;
--- a/browser/base/content/newtab/newTab.xhtml
+++ b/browser/base/content/newtab/newTab.xhtml
@@ -75,17 +75,17 @@
         <input id="newtab-search-submit" type="button"
              title="&contentSearchSubmit.tooltip;"/>
       </div>
     </div>
 
     <div id="newtab-horizontal-margin">
       <div class="newtab-side-margin"/>
       <div id="newtab-grid">
-        <h1 id="topsites-heading">&newtab.topSites.heading;</h1>
+        <h1 id="topsites-heading"/>
       </div>
       <div class="newtab-side-margin"/>
     </div>
 
     <div id="newtab-margin-bottom"/>
   </div>
   <input id="newtab-customize-button" type="button" dir="&locale.dir;"
          value="&#x2699;"
--- a/browser/locales/en-US/chrome/browser/newTab.dtd
+++ b/browser/locales/en-US/chrome/browser/newTab.dtd
@@ -1,15 +1,14 @@
 <!-- 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/. -->
 
 <!-- These strings are used in the about:newtab page -->
 <!ENTITY newtab.pageTitle "New Tab">
-<!ENTITY newtab.topSites.heading "Your Top Sites">
 <!ENTITY newtab.customize.classic "Show your top sites">
 <!ENTITY newtab.customize.cog.enhanced "Include suggested sites">
 <!ENTITY newtab.customize.cog.title2 "NEW TAB CONTROLS">
 <!ENTITY newtab.customize.cog.learn "Learn about New Tab">
 <!ENTITY newtab.customize.title "Customize your New Tab page">
 <!ENTITY newtab.customize.suggested "Show suggested and your top sites">
 <!ENTITY newtab.customize.topsites "Show your top sites">
 <!ENTITY newtab.customize.blank2 "Show blank page">
--- a/browser/locales/en-US/chrome/browser/newTab.properties
+++ b/browser/locales/en-US/chrome/browser/newTab.properties
@@ -1,12 +1,15 @@
 # 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/.
 
+newtab.defaultTopSites.heading=Top Sites
+newtab.userTopSites.heading=Your Top Sites
+
 newtab.pin=Pin this site at its current position
 newtab.unpin=Unpin this site
 newtab.block=Remove this site
 # LOCALIZATION NOTE(newtab.sponsored.button): This text appears for sponsored
 # and enhanced tiles on the same line as the tile's title, so prefer short
 # strings to avoid overlap. This string should be uppercase.
 newtab.sponsored.button=SPONSORED
 # LOCALIZATION NOTE(newtab.suggested.button): This text appears for sponsored