Bug 1563026 - Migrate search one-offs xul fragment to use fluent. r=fluent-reviewers,mak,flod
authorMark Banner <standard8@mozilla.com>
Tue, 08 Oct 2019 10:05:54 +0000
changeset 496727 1a3b3e46326198bc6cbae7f22bfe7f8fba7dc8cf
parent 496726 60d9f8a1264118769a4903adba460a2505cd66a3
child 496728 b124b26983e4ed57a994bb11a590f9d60447e478
push id36666
push userapavel@mozilla.com
push dateTue, 08 Oct 2019 16:00:46 +0000
treeherdermozilla-central@9a16c53ed5c3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfluent-reviewers, mak, flod
bugs1563026
milestone71.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 1563026 - Migrate search one-offs xul fragment to use fluent. r=fluent-reviewers,mak,flod Differential Revision: https://phabricator.services.mozilla.com/D47078
browser/components/search/content/search-one-offs.js
browser/locales/en-US/browser/browser.ftl
browser/locales/en-US/chrome/browser/browser.dtd
python/l10n/fluent_migrations/bug_1563026_migrate_search_one_offs_xul_fragment.py
--- a/browser/components/search/content/search-one-offs.js
+++ b/browser/components/search/content/search-one-offs.js
@@ -14,31 +14,30 @@
 class SearchOneOffs {
   constructor(container) {
     this.container = container;
 
     this.container.appendChild(
       MozXULElement.parseXULToFragment(
         `
       <hbox class="search-panel-one-offs-header search-panel-header search-panel-current-input">
-        <label class="search-panel-one-offs-header-label" value="&searchWithDesc.label;"/>
+        <label class="search-panel-one-offs-header-label" data-l10n-id="search-one-offs-with-title"/>
       </hbox>
       <hbox class="search-panel-one-offs" role="group"/>
       <vbox class="search-add-engines"/>
       <hbox class="search-one-offs-spacer"/>
-      <button class="searchbar-engine-one-off-item search-setting-button-compact" tooltiptext="&changeSearchSettings.tooltip;"/>
-      <button class="search-setting-button" label="&changeSearchSettings.button;"/>
+      <button class="searchbar-engine-one-off-item search-setting-button-compact" data-l10n-id="search-one-offs-change-settings-compact-button"/>
+      <button class="search-setting-button" data-l10n-id="search-one-offs-change-settings-button"/>
       <box style="visibiltiy:collapse">
         <menupopup class="search-one-offs-context-menu">
-          <menuitem class="search-one-offs-context-open-in-new-tab" label="&searchInNewTab.label;" accesskey="&searchInNewTab.accesskey;"/>
-          <menuitem class="search-one-offs-context-set-default" label="&searchSetAsDefault.label;" accesskey="&searchSetAsDefault.accesskey;"/>
+          <menuitem class="search-one-offs-context-open-in-new-tab" data-l10n-id="search-one-offs-context-open-new-tab"/>
+          <menuitem class="search-one-offs-context-set-default" data-l10n-id="search-one-offs-context-set-as-default"/>
         </menupopup>
       </box>
-      `,
-        ["chrome://browser/locale/browser.dtd"]
+      `
       )
     );
 
     this._view = null;
     this._popup = null;
     this._textbox = null;
 
     this._textboxWidth = 0;
--- a/browser/locales/en-US/browser/browser.ftl
+++ b/browser/locales/en-US/browser/browser.ftl
@@ -60,8 +60,28 @@ page-action-remove-from-urlbar =
 ## Auto-hide Context Menu
 
 full-screen-autohide =
     .label = Hide Toolbars
     .accesskey = H
 full-screen-exit =
     .label = Exit Full Screen Mode
     .accesskey = F
+
+## Search Engine selection buttons (one-offs)
+
+# This string prompts the user to use the list of one-click search engines in
+# the Urlbar and searchbar.
+search-one-offs-with-title = This time, search with:
+
+# This string won't wrap, so if the translated string is longer,
+# consider translating it as if it said only "Search Settings".
+search-one-offs-change-settings-button =
+    .label = Change Search Settings
+search-one-offs-change-settings-compact-button =
+    .tooltiptext = Change search settings
+
+search-one-offs-context-open-new-tab =
+    .label = Search in New Tab
+    .accesskey = T
+search-one-offs-context-set-as-default =
+    .label = Set As Default Search Engine
+    .accesskey = D
--- a/browser/locales/en-US/chrome/browser/browser.dtd
+++ b/browser/locales/en-US/chrome/browser/browser.dtd
@@ -385,32 +385,16 @@ convenience of Safari and Chrome users o
 
 <!ENTITY contentSearchSubmit.tooltip  "Submit search">
 
 <!-- LOCALIZATION NOTE (searchInput.placeholder):
      This string is displayed in the search box when the input field is empty. -->
 <!ENTITY searchInput.placeholder      "Search">
 <!ENTITY searchIcon.tooltip           "Search">
 
-<!-- LOCALIZATION NOTE (searchWithDesc.label):
-     This string prompts the user to use the list of one-click search engines in
-     the Urlbar and searchbar. -->
-<!ENTITY searchWithDesc.label         "This time, search with:">
-
-<!-- LOCALIZATION NOTE (changeSearchSettings.button):
-     This string won't wrap, so if the translated string is longer,
-     consider translating it as if it said only "Search Settings". -->
-<!ENTITY changeSearchSettings.button  "Change Search Settings">
-<!ENTITY changeSearchSettings.tooltip "Change search settings">
-
-<!ENTITY searchInNewTab.label         "Search in New Tab">
-<!ENTITY searchInNewTab.accesskey     "T">
-<!ENTITY searchSetAsDefault.label     "Set As Default Search Engine">
-<!ENTITY searchSetAsDefault.accesskey "D">
-
 <!ENTITY openLinkCmdInTab.label       "Open Link in New Tab">
 <!ENTITY openLinkCmdInTab.accesskey   "T">
 <!ENTITY openLinkCmd.label            "Open Link in New Window">
 <!ENTITY openLinkCmd.accesskey        "W">
 <!ENTITY openLinkInPrivateWindowCmd.label "Open Link in New Private Window">
 <!ENTITY openLinkInPrivateWindowCmd.accesskey "P">
 <!ENTITY openLinkCmdInCurrent.label     "Open Link">
 <!ENTITY openLinkCmdInCurrent.accesskey "O">
new file mode 100644
--- /dev/null
+++ b/python/l10n/fluent_migrations/bug_1563026_migrate_search_one_offs_xul_fragment.py
@@ -0,0 +1,34 @@
+# 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 import COPY_PATTERN
+
+
+def migrate(ctx):
+    """Bug 1563026 - Migrate search one-offs xul fragment to use fluent, part {index}."""
+
+    ctx.add_transforms(
+        "browser/browser/browser.ftl",
+        "browser/browser/browser.ftl",
+        transforms_from(
+            """
+search-one-offs-with-title = { COPY(from_path, "searchWithDesc.label") }
+
+search-one-offs-change-settings-button =
+    .label = { COPY(from_path, "changeSearchSettings.button") }
+search-one-offs-change-settings-compact-button =
+    .tooltiptext = { COPY(from_path, "changeSearchSettings.tooltip") }
+
+search-one-offs-context-open-new-tab =
+    .label = { COPY(from_path, "searchInNewTab.label") }
+    .accesskey = { COPY(from_path, "searchInNewTab.accesskey") }
+search-one-offs-context-set-as-default =
+    .label = { COPY(from_path, "searchSetAsDefault.label") }
+    .accesskey = { COPY(from_path, "searchSetAsDefault.accesskey") }
+""", from_path="browser/chrome/browser/browser.dtd")
+    )