Bug 1523761 - Move the syncedTabs strings from browser.dtd to fluent, r=Gijs,flod
☠☠ backed out by fd9f4d421007 ☠ ☠
authorYuan Cheng <chengy12@msu.edu>
Fri, 15 Mar 2019 18:46:46 +0000
changeset 464838 c0996caf797f1582c8797b991190e9bd3e53fb4f
parent 464837 3ea90cc2e91732daccfc382206926d0c9dc90e24
child 464839 917f02e20ab6edac88ba0d41d24a3b65409becdd
push id112485
push userdvarga@mozilla.com
push dateTue, 19 Mar 2019 09:58:30 +0000
treeherdermozilla-inbound@62a7f082c443 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, flod
bugs1523761
milestone68.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 1523761 - Move the syncedTabs strings from browser.dtd to fluent, r=Gijs,flod Differential Revision: https://phabricator.services.mozilla.com/D22980
browser/base/content/browser.xul
browser/components/syncedtabs/sidebar.js
browser/components/syncedtabs/sidebar.xhtml
browser/locales/en-US/browser/syncedTabs.ftl
browser/locales/en-US/chrome/browser/browser.dtd
python/l10n/fluent_migrations/bug_1523761_syncedTabs.py
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -632,41 +632,33 @@
         <vbox id="downloads-indicator-notification"/>
       </vbox>
     </hbox>
 
     <tooltip id="dynamic-shortcut-tooltip"
              onpopupshowing="UpdateDynamicShortcutTooltipText(this);"/>
 
     <menupopup id="SyncedTabsSidebarContext">
-      <menuitem label="&syncedTabs.context.open.label;"
-                accesskey="&syncedTabs.context.open.accesskey;"
+      <menuitem data-l10n-id="synced-tabs-context-open"
                 id="syncedTabsOpenSelected" where="current"/>
-      <menuitem label="&syncedTabs.context.openInNewTab.label;"
-                accesskey="&syncedTabs.context.openInNewTab.accesskey;"
+      <menuitem data-l10n-id="synced-tabs-context-open-in-new-tab"
                 id="syncedTabsOpenSelectedInTab" where="tab"/>
-      <menuitem label="&syncedTabs.context.openInNewWindow.label;"
-                accesskey="&syncedTabs.context.openInNewWindow.accesskey;"
+      <menuitem data-l10n-id="synced-tabs-context-open-in-new-window"
                 id="syncedTabsOpenSelectedInWindow" where="window"/>
-      <menuitem label="&syncedTabs.context.openInNewPrivateWindow.label;"
-                accesskey="&syncedTabs.context.openInNewPrivateWindow.accesskey;"
+      <menuitem data-l10n-id="synced-tabs-context-open-in-new-private-window"
                 id="syncedTabsOpenSelectedInPrivateWindow" where="window" private="true"/>
       <menuseparator/>
-      <menuitem label="&syncedTabs.context.bookmarkSingleTab.label;"
-                accesskey="&syncedTabs.context.bookmarkSingleTab.accesskey;"
+      <menuitem data-l10n-id="synced-tabs-context-bookmark-single-tab"
                 id="syncedTabsBookmarkSelected"/>
-      <menuitem label="&syncedTabs.context.copy.label;"
-                accesskey="&syncedTabs.context.copy.accesskey;"
+      <menuitem data-l10n-id="synced-tabs-context-copy"
                 id="syncedTabsCopySelected"/>
       <menuseparator/>
-      <menuitem label="&syncedTabs.context.openAllInTabs.label;"
-                accesskey="&syncedTabs.context.openAllInTabs.accesskey;"
+      <menuitem data-l10n-id="synced-tabs-context-open-all-in-tabs"
                 id="syncedTabsOpenAllInTabs"/>
-      <menuitem label="&syncedTabs.context.managedevices.label;"
-                accesskey="&syncedTabs.context.managedevices.accesskey;"
+      <menuitem data-l10n-id="synced-tabs-context-manage-devices"
                 id="syncedTabsManageDevices"
                 oncommand="gSync.openDevicesManagementPage('syncedtabs-sidebar');"/>
       <menuitem label="&syncSyncNowItem.label;"
                 accesskey="&syncSyncNowItem.accesskey;"
                 id="syncedTabsRefresh"/>
     </menupopup>
     <menupopup id="SyncedTabsSidebarTabsFilterContext"
                class="textbox-contextmenu">
--- a/browser/components/syncedtabs/sidebar.js
+++ b/browser/components/syncedtabs/sidebar.js
@@ -11,16 +11,17 @@ const {LightweightThemeChild} = ChromeUt
 ChromeUtils.defineModuleGetter(this, "fxAccounts",
                                "resource://gre/modules/FxAccounts.jsm");
 
 var syncedTabsDeckComponent = new SyncedTabsDeckComponent({window, SyncedTabs, fxAccounts});
 
 let themeListener;
 
 let onLoaded = () => {
+  window.top.MozXULElement.insertFTLIfNeeded("browser/syncedTabs.ftl");
   themeListener = new LightweightThemeChild({
     content: window,
     chromeOuterWindowID: window.top.windowUtils.outerWindowID,
     docShell: window.docShell,
   });
   syncedTabsDeckComponent.init();
   document.getElementById("template-container").appendChild(syncedTabsDeckComponent.container);
 };
--- a/browser/components/syncedtabs/sidebar.xhtml
+++ b/browser/components/syncedtabs/sidebar.xhtml
@@ -1,39 +1,33 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!-- 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/. -->
 
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" [
-  <!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd">
-  %browserDTD;
-  <!ENTITY % globalDTD
-    SYSTEM "chrome://global/locale/global.dtd">
-  %globalDTD;
-  <!ENTITY % syncBrandDTD
-    SYSTEM "chrome://browser/locale/syncBrand.dtd">
-  %syncBrandDTD;
 ]>
 <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
   <head>
     <script src="chrome://browser/content/syncedtabs/sidebar.js" type="application/javascript"></script>
     <script type="application/javascript" src="chrome://browser/content/utilityOverlay.js"/>
     <script src="chrome://browser/content/contentTheme.js"></script>
 
     <link rel="stylesheet" type="text/css" media="all" href="chrome://browser/skin/syncedtabs/sidebar.css"/>
     <link rel="stylesheet" type="text/css" media="all" href="chrome://global/skin/"/>
     <link rel="stylesheet" type="text/css" media="all" href="chrome://global/skin/textbox.css"/>
     <link rel="stylesheet" type="text/css" media="all" href="chrome://browser/content/browser.css"/>
-    <title>&syncedTabs.sidebar.label;</title>
+    <link rel="localization" href="browser/branding/sync-brand.ftl"/>
+    <link rel="localization" href="browser/syncedTabs.ftl"/>
+    <title data-l10n-id="synced-tabs-sidebar-title"></title>
   </head>
 
-  <body dir="&locale.dir;" role="application">
+  <body role="application">
     <template id="client-template">
       <div class="item client" role="option" tabindex="-1">
         <div class="item-title-container">
           <div class="item-twisty-container"></div>
           <div class="item-icon-container"></div>
           <p class="item-title"></p>
         </div>
         <div class="item-tabs-list"></div>
@@ -45,17 +39,17 @@
           <div class="item-twisty-container"></div>
           <div class="item-icon-container"></div>
           <p class="item-title"></p>
         </div>
         <div class="item-tabs-list">
           <div class="item empty" role="option" tabindex="-1">
             <div class="item-title-container">
               <div class="item-icon-container"></div>
-              <p class="item-title">&syncedTabs.sidebar.notabs.label;</p>
+              <p class="item-title" data-l10n-id="synced-tabs-sidebar-notabs"></p>
             </div>
           </div>
         </div>
       </div>
     </template>
     <template id="tab-template">
       <div class="item tab" role="option" tabindex="-1">
         <div class="item-title-container">
@@ -73,51 +67,51 @@
 
     <template id="deck-template">
       <div class="deck">
         <div class="tabs-fetching sync-state">
           <!-- Show intentionally blank panel, see bug 1239845 -->
         </div>
         <div class="notAuthedInfo sync-state">
           <div class="syncIllustration"></div>
-          <p class="instructions">&syncedTabs.sidebar.notsignedin.label;</p>
-          <button class="button sync-prefs">&fxaSignIn.label;</button>
+          <p class="instructions" data-l10n-id="synced-tabs-sidebar-notsignedin"></p>
+          <button class="button sync-prefs" data-l10n-id="fxa-sign-in"></button>
         </div>
         <div class="reauth sync-state">
           <div class="syncIllustrationIssue"></div>
-          <p class="instructions">&syncedTabs.sidebar.notsignedin.label;</p>
-          <button class="button sync-prefs">&fxaSignIn.label;</button>
+          <p class="instructions" data-l10n-id="synced-tabs-sidebar-notsignedin"></p>
+          <button class="button sync-prefs" data-l10n-id="fxa-sign-in"></button>
         </div>
         <div class="unverified sync-state">
           <div class="syncIllustrationIssue"></div>
-          <p class="instructions">&syncedTabs.sidebar.unverified.label;</p>
-          <button class="button sync-prefs">&syncedTabs.sidebar.openprefs.label;</button>
+          <p class="instructions" data-l10n-id="synced-tabs-sidebar-unverified"></p>
+          <button class="button sync-prefs" data-l10n-id="synced-tabs-sidebar-openprefs"></button>
         </div>
         <div class="singleDeviceInfo sync-state">
           <div class="syncIllustrationIssue"></div>
-          <p class="instructions">&syncedTabs.sidebar.noclients.subtitle;</p>
-          <button class="button connect-device">&syncedTabs.sidebar.connectAnotherDevice;</button>
+          <p class="instructions" data-l10n-id="synced-tabs-sidebar-noclients-subtitle"></p>
+          <button class="button connect-device" data-l10n-id="synced-tabs-sidebar-connect-another-device"></button>
         </div>
         <div class="tabs-disabled sync-state">
           <div class="syncIllustrationIssue"></div>
-          <p class="instructions">&syncedTabs.sidebar.tabsnotsyncing.label;</p>
-          <button class="button sync-prefs">&syncedTabs.sidebar.openprefs.label;</button>
+          <p class="instructions" data-l10n-id="synced-tabs-sidebar-tabsnotsyncing"></p>
+          <button class="button sync-prefs" data-l10n-id="synced-tabs-sidebar-openprefs"></button>
         </div>
       </div>
     </template>
 
     <div class="content-container">
       <!-- the non-scrollable header -->
       <div class="content-header">
         <div class="sidebar-search-container tabs-container sync-state">
           <div class="search-box">
             <div class="textbox-input-box">
               <input type="text"
                      class="tabsFilter textbox-input"
-                     placeholder="&syncedTabs.sidebar.searchPlaceholder;"
+                     data-l10n-id="synced-tabs-sidebar-search"
                      tabindex="1"/>
               <div class="textbox-search-icons">
                 <a class="textbox-search-clear"></a>
               </div>
             </div>
           </div>
         </div>
       </div>
new file mode 100644
--- /dev/null
+++ b/browser/locales/en-US/browser/syncedTabs.ftl
@@ -0,0 +1,39 @@
+# 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/.
+
+synced-tabs-sidebar-title = Synced Tabs
+synced-tabs-sidebar-noclients-subtitle = Want to see your tabs from other devices here?
+synced-tabs-sidebar-notsignedin = Sign in to view a list of tabs from your other devices.
+synced-tabs-sidebar-unverified = Your account needs to be verified.
+synced-tabs-sidebar-notabs = No open tabs
+synced-tabs-sidebar-openprefs = Open { -sync-brand-short-name } Preferences
+synced-tabs-sidebar-tabsnotsyncing = Turn on tab syncing to view a list of tabs from your other devices.
+synced-tabs-sidebar-connect-another-device = Connect Another Device
+synced-tabs-sidebar-search =
+    .placeholder = Search synced tabs
+synced-tabs-context-open =
+    .label = Open
+    .accesskey = O
+synced-tabs-context-open-in-new-tab =
+    .label = Open in a New Tab
+    .accesskey = w
+synced-tabs-context-open-in-new-window =
+    .label = Open in a New Window
+    .accesskey = N
+synced-tabs-context-open-in-new-private-window =
+    .label = Open in a New Private Window
+    .accesskey = P
+synced-tabs-context-bookmark-single-tab =
+    .label = Bookmark This Tab…
+    .accesskey = B
+synced-tabs-context-copy =
+    .label = Copy
+    .accesskey = C
+synced-tabs-context-open-all-in-tabs =
+    .label = Open All in Tabs
+    .accesskey = O
+synced-tabs-context-manage-devices =
+    .label = Manage Devices…
+    .accesskey = D
+fxa-sign-in = Sign in to { -sync-brand-short-name }
--- a/browser/locales/en-US/chrome/browser/browser.dtd
+++ b/browser/locales/en-US/chrome/browser/browser.dtd
@@ -908,50 +908,16 @@ you can use these alternative items. Oth
 <!-- Name for the tabs toolbar as spoken by screen readers.
      The word "toolbar" is appended automatically and should not be contained below! -->
 <!ENTITY tabsToolbar.label "Browser tabs">
 
 <!-- LOCALIZATION NOTE (syncTabsMenu3.label): This appears in the history menu -->
 <!ENTITY syncTabsMenu3.label     "Synced Tabs">
 
 <!ENTITY syncedTabs.sidebar.label              "Synced Tabs">
-<!ENTITY syncedTabs.sidebar.noclients.label    "Sign in to Firefox from your other devices to view their tabs here.">
-<!ENTITY syncedTabs.sidebar.noclients.subtitle "Want to see your tabs from other devices here?">
-<!ENTITY syncedTabs.sidebar.notsignedin.label  "Sign in to view a list of tabs from your other devices.">
-<!ENTITY syncedTabs.sidebar.unverified.label   "Your account needs to be verified.">
-<!ENTITY syncedTabs.sidebar.notabs.label       "No open tabs">
-<!ENTITY syncedTabs.sidebar.openprefs.label    "Open &syncBrand.shortName.label; Preferences">
-<!-- LOCALIZATION NOTE (syncedTabs.sidebar.tabsnotsyncing.label): This is shown
-     when Sync is configured but syncing tabs is disabled. -->
-<!ENTITY syncedTabs.sidebar.tabsnotsyncing.label       "Turn on tab syncing to view a list of tabs from your other devices.">
-<!ENTITY syncedTabs.sidebar.searchPlaceholder  "Search synced tabs">
-<!ENTITY syncedTabs.sidebar.connectAnotherDevice  "Connect Another Device">
-
-<!-- LOCALIZATION NOTE (syncedTabs.context.open.accesskey,
-                        syncedTabs.context.openAllInTabs.accesskey):
-     These access keys are identical because their associated menu items are
-     mutually exclusive -->
-<!ENTITY syncedTabs.context.open.label                       "Open">
-<!ENTITY syncedTabs.context.open.accesskey                   "O">
-<!ENTITY syncedTabs.context.openInNewTab.label               "Open in a New Tab">
-<!ENTITY syncedTabs.context.openInNewTab.accesskey           "w">
-<!ENTITY syncedTabs.context.openInNewWindow.label            "Open in a New Window">
-<!ENTITY syncedTabs.context.openInNewWindow.accesskey        "N">
-<!ENTITY syncedTabs.context.openInNewPrivateWindow.label     "Open in a New Private Window">
-<!ENTITY syncedTabs.context.openInNewPrivateWindow.accesskey "P">
-<!ENTITY syncedTabs.context.bookmarkSingleTab.label          "Bookmark This Tab…">
-<!ENTITY syncedTabs.context.bookmarkSingleTab.accesskey      "B">
-<!ENTITY syncedTabs.context.copy.label                       "Copy">
-<!ENTITY syncedTabs.context.copy.accesskey                   "C">
-
-<!ENTITY syncedTabs.context.openAllInTabs.label              "Open All in Tabs">
-<!ENTITY syncedTabs.context.openAllInTabs.accesskey          "O">
-<!ENTITY syncedTabs.context.managedevices.label              "Manage Devices…">
-<!ENTITY syncedTabs.context.managedevices.accesskey          "D">
-
 
 <!ENTITY syncBrand.shortName.label    "Sync">
 
 <!ENTITY syncSignIn.label             "Sign In To &syncBrand.shortName.label;…">
 <!ENTITY syncSignIn.accesskey         "Y">
 <!ENTITY syncSyncNowItem.label        "Sync Now">
 <!ENTITY syncSyncNowItemSyncing.label "Syncing…">
 <!ENTITY syncSyncNowItem.accesskey    "S">
new file mode 100644
--- /dev/null
+++ b/python/l10n/fluent_migrations/bug_1523761_syncedTabs.py
@@ -0,0 +1,82 @@
+# 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 import COPY
+from fluent.migrate import REPLACE
+from fluent.migrate.helpers import transforms_from
+from fluent.migrate.helpers import TERM_REFERENCE
+
+def migrate(ctx):
+    """Bug 1523761 - Move the syncedTabs strings from browser.dtd to fluent, part {index}."""
+
+    ctx.add_transforms(
+        "browser/browser/syncedTabs.ftl",
+        "browser/browser/syncedTabs.ftl",
+        transforms_from(
+"""
+synced-tabs-sidebar-title = { COPY(from_path, "syncedTabs.sidebar.label") }
+synced-tabs-sidebar-noclients-subtitle = { COPY(from_path, "syncedTabs.sidebar.noclients.subtitle") }
+synced-tabs-sidebar-notsignedin = { COPY(from_path, "syncedTabs.sidebar.notsignedin.label") }
+synced-tabs-sidebar-unverified = { COPY(from_path, "syncedTabs.sidebar.unverified.label") }
+synced-tabs-sidebar-notabs = { COPY(from_path, "syncedTabs.sidebar.notabs.label") }
+synced-tabs-sidebar-tabsnotsyncing = { COPY(from_path, "syncedTabs.sidebar.tabsnotsyncing.label") }
+synced-tabs-sidebar-connect-another-device = { COPY(from_path, "syncedTabs.sidebar.connectAnotherDevice") }
+synced-tabs-sidebar-search =
+    .placeholder = { COPY(from_path, "syncedTabs.sidebar.searchPlaceholder") }
+synced-tabs-context-open =
+    .label = { COPY(from_path, "syncedTabs.context.open.label") }
+    .accesskey = { COPY(from_path, "syncedTabs.context.open.accesskey") }
+synced-tabs-context-open-in-new-tab =
+    .label = { COPY(from_path, "syncedTabs.context.openInNewTab.label") }
+    .accesskey = { COPY(from_path, "syncedTabs.context.openInNewTab.accesskey") }
+synced-tabs-context-open-in-new-window =
+    .label = { COPY(from_path, "syncedTabs.context.openInNewWindow.label") }
+    .accesskey = { COPY(from_path, "syncedTabs.context.openInNewWindow.accesskey") }
+synced-tabs-context-open-in-new-private-window =
+    .label = { COPY(from_path, "syncedTabs.context.openInNewPrivateWindow.label") }
+    .accesskey = { COPY(from_path, "syncedTabs.context.openInNewPrivateWindow.accesskey") }
+synced-tabs-context-bookmark-single-tab =
+    .label = { COPY(from_path, "syncedTabs.context.bookmarkSingleTab.label") }
+    .accesskey = { COPY(from_path, "syncedTabs.context.bookmarkSingleTab.accesskey") }
+synced-tabs-context-copy =
+    .label = { COPY(from_path, "syncedTabs.context.copy.label") }
+    .accesskey = { COPY(from_path, "syncedTabs.context.copy.accesskey") }
+synced-tabs-context-open-all-in-tabs =
+    .label = { COPY(from_path, "syncedTabs.context.openAllInTabs.label") }
+    .accesskey = { COPY(from_path, "syncedTabs.context.openAllInTabs.accesskey") }
+synced-tabs-context-manage-devices =
+    .label = { COPY(from_path, "syncedTabs.context.managedevices.label") }
+    .accesskey = { COPY(from_path, "syncedTabs.context.managedevices.accesskey") }
+""", from_path="browser/chrome/browser/browser.dtd")
+    )
+
+    ctx.add_transforms(
+        "browser/browser/syncedTabs.ftl",
+        "browser/browser/syncedTabs.ftl",
+        [
+            FTL.Message(
+                id=FTL.Identifier("fxa-sign-in"),
+                value=REPLACE(
+                    "browser/chrome/browser/browser.dtd",
+                    "fxaSignIn.label",
+                    {
+                        "&syncBrand.shortName.label;": TERM_REFERENCE("sync-brand-short-name"),
+                    },
+                )
+            ),
+            FTL.Message(
+                id=FTL.Identifier("synced-tabs-sidebar-openprefs"),
+                value=REPLACE(
+                    "browser/chrome/browser/browser.dtd",
+                    "syncedTabs.sidebar.openprefs.label",
+                    {
+                        "&syncBrand.shortName.label;": TERM_REFERENCE("sync-brand-short-name"),
+                    },
+                )
+            ),
+        ]
+    )