Bug 1185845 - Fix localization issues in in-content search UI. r=adw
authorNihanth Subramanya <nhnt11@gmail.com>
Wed, 22 Jul 2015 02:30:10 -0700
changeset 286400 f389c9c1eafbe674bb567700f6aa28d35a85354b
parent 286399 00bc6fe33be0f4481a52b47d1e1447130e37745b
child 286401 11654ad37d5ed6f7c4c76c3d236f66c553a453da
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersadw
bugs1185845
milestone42.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 1185845 - Fix localization issues in in-content search UI. r=adw
browser/base/content/contentSearchUI.js
browser/locales/en-US/chrome/browser/search.properties
browser/modules/ContentSearch.jsm
--- a/browser/base/content/contentSearchUI.js
+++ b/browser/base/content/contentSearchUI.js
@@ -453,16 +453,18 @@ ContentSearchUIController.prototype = {
     }
     this._pendingOneOffRefresh = true;
   },
 
   _onMsgStrings: function (strings) {
     this._strings = strings;
     this._updateDefaultEngineHeader();
     this._updateSearchWithHeader();
+    document.getElementById("contentSearchSettingsButton").textContent =
+      this._strings.searchSettings;
   },
 
   _updateDefaultEngineHeader: function () {
     let header = document.getElementById("contentSearchDefaultEngineHeader");
     if (this.defaultEngine.icon) {
       header.firstChild.setAttribute("src", this.defaultEngine.icon);
     }
     if (!this._strings) {
@@ -479,22 +481,20 @@ ContentSearchUIController.prototype = {
     if (!this._strings) {
       return;
     }
     let searchWithHeader = document.getElementById("contentSearchSearchWithHeader");
     while (searchWithHeader.firstChild) {
       searchWithHeader.firstChild.remove();
     }
     if (this.input.value) {
-      searchWithHeader.appendChild(document.createTextNode(this._strings.searchFor));
-      let span = document.createElementNS(HTML_NS, "span");
-      span.setAttribute("class", "contentSearchSearchWithHeaderSearchText");
-      span.appendChild(document.createTextNode(" " + this.input.value + " "));
-      searchWithHeader.appendChild(span);
-      searchWithHeader.appendChild(document.createTextNode(this._strings.searchWith));
+      let html = "<span class='contentSearchSearchWithHeaderSearchText'>" +
+                 this.input.value + "</span>";
+      html = this._strings.searchForKeywordsWith.replace("%S", html);
+      searchWithHeader.innerHTML = html;
       return;
     }
     searchWithHeader.appendChild(document.createTextNode(this._strings.searchWithHeader));
   },
 
   _speculativeConnect: function () {
     if (this.defaultEngine) {
       this._sendMsg("SpeculativeConnect", this.defaultEngine.name);
@@ -649,17 +649,16 @@ ContentSearchUIController.prototype = {
     header = document.createElementNS(HTML_NS, "td");
     headerRow.setAttribute("class", "contentSearchHeaderRow");
     header.setAttribute("class", "contentSearchHeader");
     headerRow.appendChild(header);
     header.id = "contentSearchSearchWithHeader";
     this._oneOffsTable.appendChild(headerRow);
 
     let button = document.createElementNS(HTML_NS, "button");
-    button.appendChild(document.createTextNode("Change Search Settings"));
     button.setAttribute("class", "contentSearchSettingsButton");
     button.classList.add("contentSearchHeaderRow");
     button.classList.add("contentSearchHeader");
     button.id = "contentSearchSettingsButton";
     button.addEventListener("click", this);
     button.addEventListener("mousemove", this);
     this._table.appendChild(button);
 
--- a/browser/locales/en-US/chrome/browser/search.properties
+++ b/browser/locales/en-US/chrome/browser/search.properties
@@ -28,19 +28,22 @@ cmd_showSuggestions_accesskey=S
 # menuitem at the bottom of the search panel.
 cmd_addFoundEngine=Add "%S"
 # LOCALIZATION NOTE (cmd_addFoundEngineMenu): When more than 5 engines
 # are offered by a web page, instead of listing all of them in the
 # search panel using the cmd_addFoundEngine string, they will be
 # grouped in a submenu using cmd_addFoundEngineMenu as a label.
 cmd_addFoundEngineMenu=Add search engine
 
-# LOCALIZATION NOTE (searchFor, searchWith):
-# These two strings are used to build the header above the list of one-click
+# LOCALIZATION NOTE (searchForKeywordsWith):
+# This string is used to build the header above the list of one-click
 # search providers:  "Search for <user-typed keywords> with:"
-searchFor=Search for 
-searchWith= with:
+searchForKeywordsWith=Search for %S with:
 
 # LOCALIZATION NOTE (searchWithHeader):
 # The wording of this string should be as close as possible to
-# searchFor and searchWith. This string will be used instead of
-# them when the user has not typed any keyword.
+# searchForKeywordsWith. This string will be used when the user
+# has not typed anything.
 searchWithHeader=Search with:
+
+# LOCALIZATION NOTE (searchSettings):
+# This is the label for the button that opens Search preferences.
+searchSettings=Change Search Settings
--- a/browser/modules/ContentSearch.jsm
+++ b/browser/modules/ContentSearch.jsm
@@ -109,18 +109,18 @@ this.ContentSearch = {
   },
 
   get searchSuggestionUIStrings() {
     if (this._searchSuggestionUIStrings) {
       return this._searchSuggestionUIStrings;
     }
     this._searchSuggestionUIStrings = {};
     let searchBundle = Services.strings.createBundle("chrome://browser/locale/search.properties");
-    let stringNames = ["searchHeader", "searchPlaceholder", "searchFor",
-                       "searchWith", "searchWithHeader"];
+    let stringNames = ["searchHeader", "searchPlaceholder", "searchForKeywordsWith",
+                       "searchWithHeader", "searchSettings"];
     for (let name of stringNames) {
       this._searchSuggestionUIStrings[name] = searchBundle.GetStringFromName(name);
     }
     return this._searchSuggestionUIStrings;
   },
 
   destroy: function () {
     if (this._destroyedPromise) {