Bug 1451992 - Migrate Preferences::Subdialogs::ClearSiteData to Fluent. r?jaws,stas draft
authorZibi Braniecki <zbraniecki@mozilla.com>
Thu, 05 Apr 2018 02:39:59 +0200
changeset 779875 61c3855a3d2db754e99201013a5b623e787eda8f
parent 779874 b3be5835f5caabf36f9d43fc31a82a1826e418dd
child 779876 ee6f7a8bdc1f336177690b137d2a65f96b1953db
push id105900
push userbmo:gandalf@aviary.pl
push dateTue, 10 Apr 2018 19:01:04 +0000
reviewersjaws, stas
bugs1451992
milestone61.0a1
Bug 1451992 - Migrate Preferences::Subdialogs::ClearSiteData to Fluent. r?jaws,stas MozReview-Commit-ID: 4geJkI3OACq
browser/components/preferences/clearSiteData.xul
browser/components/preferences/in-content/preferences.xul
browser/components/preferences/in-content/privacy.xul
browser/locales/en-US/browser/preferences/clearSiteData.ftl
browser/locales/en-US/chrome/browser/preferences/clearSiteData.dtd
browser/locales/jar.mn
python/l10n/fluent_migrations/bug_1451992_preferences_clearSiteData.py
--- a/browser/components/preferences/clearSiteData.xul
+++ b/browser/components/preferences/clearSiteData.xul
@@ -3,62 +3,63 @@
 <!-- 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/. -->
 
 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
 <?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?>
 <?xml-stylesheet href="chrome://browser/content/preferences/clearSiteData.css" type="text/css"?>
 
-<!DOCTYPE dialog [
- <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
- <!ENTITY % clearSiteDataDTD SYSTEM "chrome://browser/locale/preferences/clearSiteData.dtd">
- %brandDTD;
- %clearSiteDataDTD;
-]>
-
 <window id="ClearSiteDataDialog" class="windowDialog"
         windowtype="Browser:ClearSiteData"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
-        style="width: &window.width;;"
-        title="&window.title;"
+        data-l10n-id="clear-site-data-window"
+        data-l10n-attrs="title, style"
         persist="screenX screenY width height">
 
+  <link rel="localization" href="branding/brand.ftl"/>
+  <link rel="localization" href="browser/preferences/clearSiteData.ftl"/>
+  <script type="application/javascript" src="chrome://global/content/l10n.js"></script>
+
   <script src="chrome://browser/content/preferences/clearSiteData.js"/>
 
   <stringbundle id="bundlePreferences"
                 src="chrome://browser/locale/preferences/preferences.properties"/>
 
   <keyset>
-    <key key="&windowClose.key;" modifiers="accel" oncommand="window.close();"/>
+    <key data-l10n-id="clear-site-data-close-key" modifiers="accel" oncommand="window.close();"/>
   </keyset>
 
   <vbox class="contentPane largeDialogContainer" flex="1">
-    <description control="url">&window.description;</description>
+    <description control="url" data-l10n-id="clear-site-data-description"/>
     <separator class="thin"/>
     <vbox class="options-container">
       <hbox class="option">
-        <checkbox id="clearSiteData" checked="true"
-                  accesskey="&clearSiteData.accesskey;" />
+        <checkbox id="clearSiteData" checked="true" />
         <vbox>
-          <label for="clearSiteData" id="clearSiteDataLabel" value="&clearSiteData.label;" />
-          <description class="option-description">&clearSiteData.description;</description>
+          <label for="clearSiteData"
+                 id="clearSiteDataLabel"
+                 control="clearSiteData"
+                 data-l10n-id="clear-site-data-cookies" />
+          <description class="option-description" data-l10n-id="clear-site-data-cookies-info" />
         </vbox>
       </hbox>
       <hbox class="option">
-        <checkbox id="clearCache" checked="true"
-                  accesskey="&clearCache.accesskey;" />
+        <checkbox id="clearCache" checked="true" />
         <vbox>
-          <label for="clearCache" id="clearCacheLabel" value="&clearCache.label;" />
-          <description class="option-description">&clearCache.description;</description>
+          <label for="clearCache"
+                 id="clearCacheLabel"
+                 control="clearCache"
+                 data-l10n-id="clear-site-data-cache" />
+          <description class="option-description" data-l10n-id="clear-site-data-cache-info"/>
         </vbox>
       </hbox>
     </vbox>
   </vbox>
   <vbox>
     <hbox class="actionButtons" align="right" flex="1">
       <button id="cancelButton" icon="close"
-              label="&button.cancel.label;" accesskey="&button.cancel.accesskey;" />
+              data-l10n-id="clear-site-data-cancel" />
       <button id="clearButton" icon="save"
-              label="&button.clear.label;" accesskey="&button.clear.accesskey;"/>
+              data-l10n-id="clear-site-data-clear" />
     </hbox>
   </vbox>
 </window>
--- a/browser/components/preferences/in-content/preferences.xul
+++ b/browser/components/preferences/in-content/preferences.xul
@@ -26,18 +26,16 @@
 <!ENTITY % permissionsDTD SYSTEM "chrome://browser/locale/preferences/permissions.dtd">
 <!ENTITY % passwordManagerDTD SYSTEM "chrome://passwordmgr/locale/passwordManager.dtd">
 <!ENTITY % historyDTD SYSTEM "chrome://mozapps/locale/update/history.dtd">
 <!ENTITY % certManagerDTD SYSTEM "chrome://pippki/locale/certManager.dtd">
 <!ENTITY % deviceManangerDTD SYSTEM "chrome://pippki/locale/deviceManager.dtd">
 <!ENTITY % connectionDTD SYSTEM "chrome://browser/locale/preferences/connection.dtd">
 <!ENTITY % siteDataSettingsDTD SYSTEM
   "chrome://browser/locale/preferences/siteDataSettings.dtd" >
-<!ENTITY % clearSiteDataDTD SYSTEM
-  "chrome://browser/locale/preferences/clearSiteData.dtd" >
 <!ENTITY % privacyDTD SYSTEM "chrome://browser/locale/preferences/privacy.dtd">
 <!ENTITY % syncBrandDTD SYSTEM "chrome://browser/locale/syncBrand.dtd">
 <!ENTITY % syncDTD SYSTEM "chrome://browser/locale/preferences/sync.dtd">
 <!ENTITY % sanitizeDTD SYSTEM "chrome://browser/locale/sanitize.dtd">
 <!ENTITY % mainDTD SYSTEM "chrome://browser/locale/preferences/main.dtd">
 <!ENTITY % aboutHomeDTD SYSTEM "chrome://browser/locale/aboutHome.dtd">
 <!ENTITY % contentDTD SYSTEM "chrome://browser/locale/preferences/content.dtd">
 <!ENTITY % aboutDialogDTD SYSTEM "chrome://browser/locale/aboutDialog.dtd" >
@@ -49,17 +47,16 @@
 %colorsDTD;
 %permissionsDTD;
 %passwordManagerDTD;
 %historyDTD;
 %certManagerDTD;
 %deviceManangerDTD;
 %connectionDTD;
 %siteDataSettingsDTD;
-%clearSiteDataDTD;
 %privacyDTD;
 %syncBrandDTD;
 %syncDTD;
 %sanitizeDTD;
 %mainDTD;
 %aboutHomeDTD;
 %contentDTD;
 ]>
@@ -72,17 +69,20 @@
       xmlns:html="http://www.w3.org/1999/xhtml"
       disablefastfind="true"
       data-l10n-id="pref-page"
       data-l10n-attrs="title">
 
   <link rel="localization" href="branding/brand.ftl"/>
   <link rel="localization" href="browser/branding/sync-brand.ftl"/>
   <link rel="localization" href="browser/preferences/preferences.ftl"/>
+
+  <!-- Links below are only used for search-l10n-ids into subdialogs -->
   <link rel="localization" href="browser/preferences/blocklists.ftl"/>
+  <link rel="localization" href="browser/preferences/clearSiteData.ftl"/>
 
   <script type="text/javascript" src="chrome://global/content/l10n.js"></script>
 
   <html:link rel="shortcut icon"
               href="chrome://browser/skin/settings.svg"/>
 
   <script type="application/javascript"
           src="chrome://browser/content/utilityOverlay.js"/>
--- a/browser/components/preferences/in-content/privacy.xul
+++ b/browser/components/preferences/in-content/privacy.xul
@@ -221,18 +221,17 @@
       </radiogroup>
     </vbox>
     <vbox>
       <!-- Please don't remove the wrapping hbox/vbox/box for these elements. It's used to properly compute the search tooltip position. -->
       <hbox>
         <button id="clearSiteDataButton"
             class="accessory-button"
             icon="clear"
-            searchkeywords="&clearSiteData.label;
-                            &clearCache.label;"
+            search-l10n-ids="clear-site-data-cookies, clear-site-data-cache"
             data-l10n-id="sitedata-clear"/>
       </hbox>
       <hbox>
         <button id="siteDataSettings"
                 class="accessory-button"
                 data-l10n-id="sitedata-settings"
                 searchkeywords="&window2.title;
                                 &hostCol.label;
new file mode 100644
--- /dev/null
+++ b/browser/locales/en-US/browser/preferences/clearSiteData.ftl
@@ -0,0 +1,30 @@
+# 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/.
+
+clear-site-data-window =
+    .title = Clear Data
+    .style = width: 35em
+
+clear-site-data-description = Clearing all cookies and site data stored by { -brand-short-name } may sign you out of websites and remove offline web content. Clearing cache data will not affect your logins.
+
+clear-site-data-close-key =
+    .key = w
+
+clear-site-data-cookies = Cookies and Site Data
+    .accesskey = S
+
+clear-site-data-cookies-info = You may get signed out of websites if cleared
+
+clear-site-data-cache = Cache Web Content
+    .accesskey = W
+
+clear-site-data-cache-info = Will require websites to reload images and data
+
+clear-site-data-cancel =
+    .label = Cancel
+    .accesskey = C
+
+clear-site-data-clear =
+    .label = Clear
+    .accesskey = l
deleted file mode 100644
--- a/browser/locales/en-US/chrome/browser/preferences/clearSiteData.dtd
+++ /dev/null
@@ -1,22 +0,0 @@
-<!-- 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/. -->
-
-<!ENTITY window.title                 "Clear Data">
-<!ENTITY window.width                 "35em">
-
-<!ENTITY window.description           "Clearing all cookies and site data stored by &brandShortName; may sign you out of websites and remove offline web content. Clearing cache data will not affect your logins.">
-<!ENTITY windowClose.key              "w">
-
-<!ENTITY clearSiteData.label          "Cookies and Site Data">
-<!ENTITY clearSiteData.accesskey      "S">
-<!ENTITY clearSiteData.description    "You may get signed out of websites if cleared">
-
-<!ENTITY clearCache.label             "Cached Web Content">
-<!ENTITY clearCache.accesskey         "W">
-<!ENTITY clearCache.description       "Will require websites to reload images and data">
-
-<!ENTITY button.cancel.label          "Cancel">
-<!ENTITY button.cancel.accesskey      "C">
-<!ENTITY button.clear.label           "Clear">
-<!ENTITY button.clear.accesskey       "l">
--- a/browser/locales/jar.mn
+++ b/browser/locales/jar.mn
@@ -50,17 +50,16 @@
     locale/browser/places/bookmarkProperties.properties (%chrome/browser/places/bookmarkProperties.properties)
     locale/browser/safebrowsing/phishing-afterload-warning-message.dtd (%chrome/browser/safebrowsing/phishing-afterload-warning-message.dtd)
     locale/browser/safebrowsing/report-phishing.dtd                    (%chrome/browser/safebrowsing/report-phishing.dtd)
     locale/browser/safebrowsing/safebrowsing.properties   (%chrome/browser/safebrowsing/safebrowsing.properties)
     locale/browser/feeds/subscribe.dtd              (%chrome/browser/feeds/subscribe.dtd)
     locale/browser/feeds/subscribe.properties       (%chrome/browser/feeds/subscribe.properties)
     locale/browser/migration/migration.dtd         (%chrome/browser/migration/migration.dtd)
     locale/browser/migration/migration.properties  (%chrome/browser/migration/migration.properties)
-    locale/browser/preferences/clearSiteData.dtd      (%chrome/browser/preferences/clearSiteData.dtd)
     locale/browser/preferences/clearSiteData.properties     (%chrome/browser/preferences/clearSiteData.properties)
     locale/browser/preferences/colors.dtd             (%chrome/browser/preferences/colors.dtd)
     locale/browser/preferences/connection.dtd         (%chrome/browser/preferences/connection.dtd)
     locale/browser/preferences/content.dtd            (%chrome/browser/preferences/content.dtd)
     locale/browser/preferences/fonts.dtd              (%chrome/browser/preferences/fonts.dtd)
     locale/browser/preferences/languages.dtd          (%chrome/browser/preferences/languages.dtd)
     locale/browser/preferences/main.dtd               (%chrome/browser/preferences/main.dtd)
     locale/browser/preferences/permissions.dtd        (%chrome/browser/preferences/permissions.dtd)
new file mode 100644
--- /dev/null
+++ b/python/l10n/fluent_migrations/bug_1451992_preferences_clearSiteData.py
@@ -0,0 +1,147 @@
+# 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 MESSAGE_REFERENCE
+from fluent.migrate import COPY, CONCAT, REPLACE
+
+def migrate(ctx):
+    """Bug 1451992 - Migrate Preferences::Subdialogs::ClearSiteData to Fluent, part {index}."""
+
+    ctx.add_transforms(
+        'browser/browser/preferences/clearSiteData.ftl',
+        'browser/browser/preferences/clearSiteData.ftl',
+        [
+            FTL.Message(
+                id=FTL.Identifier('clear-site-data-window'),
+                attributes=[
+                    FTL.Attribute(
+                        FTL.Identifier('title'),
+                        COPY(
+                            'browser/chrome/browser/preferences/clearSiteData.dtd',
+                            'window.title',
+                        ),
+                    ),
+                    FTL.Attribute(
+                        FTL.Identifier('style'),
+                        CONCAT(
+                            FTL.TextElement('width: '),
+                            COPY(
+                                'browser/chrome/browser/preferences/clearSiteData.dtd',
+                                'window.width',
+                            ),
+                        )
+                    ),
+                ],
+            ),
+            FTL.Message(
+                id=FTL.Identifier('clear-site-data-description'),
+                value=REPLACE(
+                    'browser/chrome/browser/preferences/clearSiteData.dtd',
+                    'window.description',
+                    {
+                        '&brandShortName;': MESSAGE_REFERENCE('-brand-short-name')
+                    },
+                ),
+            ),
+            FTL.Message(
+                id=FTL.Identifier('clear-site-data-close-key'),
+                attributes=[
+                    FTL.Attribute(
+                        FTL.Identifier('key'),
+                        COPY(
+                            'browser/chrome/browser/preferences/clearSiteData.dtd',
+                            'windowClose.key',
+                        ),
+                    ),
+                ],
+            ),
+            FTL.Message(
+                id=FTL.Identifier('clear-site-data-cookies'),
+                value=COPY(
+                    'browser/chrome/browser/preferences/clearSiteData.dtd',
+                    'clearSiteData.label',
+                ),
+                attributes=[
+                    FTL.Attribute(
+                        FTL.Identifier('accesskey'),
+                        COPY(
+                            'browser/chrome/browser/preferences/clearSiteData.dtd',
+                            'clearSiteData.accesskey',
+                        ),
+                    ),
+                ],
+            ),
+            FTL.Message(
+                id=FTL.Identifier('clear-site-data-cookies-info'),
+                value=COPY(
+                    'browser/chrome/browser/preferences/clearSiteData.dtd',
+                    'clearSiteData.description',
+                ),
+            ),
+            FTL.Message(
+                id=FTL.Identifier('clear-site-data-cache'),
+                value=COPY(
+                    'browser/chrome/browser/preferences/clearSiteData.dtd',
+                    'clearCache.label',
+                ),
+                attributes=[
+                    FTL.Attribute(
+                        FTL.Identifier('accesskey'),
+                        COPY(
+                            'browser/chrome/browser/preferences/clearSiteData.dtd',
+                            'clearCache.accesskey',
+                        ),
+                    ),
+                ],
+            ),
+            FTL.Message(
+                id=FTL.Identifier('clear-site-data-cache-info'),
+                value=COPY(
+                    'browser/chrome/browser/preferences/clearSiteData.dtd',
+                    'clearCache.description',
+                ),
+            ),
+            FTL.Message(
+                id=FTL.Identifier('clear-site-data-cancel'),
+                attributes=[
+                    FTL.Attribute(
+                        FTL.Identifier('label'),
+                        COPY(
+                            'browser/chrome/browser/preferences/clearSiteData.dtd',
+                            'button.cancel.label',
+                        ),
+                    ),
+                    FTL.Attribute(
+                        FTL.Identifier('accesskey'),
+                        COPY(
+                            'browser/chrome/browser/preferences/clearSiteData.dtd',
+                            'button.cancel.accesskey',
+                        ),
+                    ),
+                ],
+            ),
+            FTL.Message(
+                id=FTL.Identifier('clear-site-data-clear'),
+                attributes=[
+                    FTL.Attribute(
+                        FTL.Identifier('label'),
+                        COPY(
+                            'browser/chrome/browser/preferences/clearSiteData.dtd',
+                            'button.clear.label',
+                        ),
+                    ),
+                    FTL.Attribute(
+                        FTL.Identifier('accesskey'),
+                        COPY(
+                            'browser/chrome/browser/preferences/clearSiteData.dtd',
+                            'button.clear.accesskey',
+                        ),
+                    ),
+                ],
+            ),
+        ]
+    )