Bug 1608167 - port setDesktopBackground DTD to fluent r=Gijs,fluent-reviewers,flod
authorArtem <salniker@msu.edu>
Fri, 07 Feb 2020 12:27:21 +0000
changeset 513040 0bdd4ce4d06e44d39eceec71238c40fed6655bc8
parent 513039 3244330ee9d604a35a7b844641e879800d77ab62
child 513041 7b02447f8c6d0b9ff9248d48171e8a3dbcc86775
push id106825
push usergijskruitbosch@gmail.com
push dateMon, 10 Feb 2020 14:57:26 +0000
treeherderautoland@0bdd4ce4d06e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, fluent-reviewers, flod
bugs1608167
milestone74.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 1608167 - port setDesktopBackground DTD to fluent r=Gijs,fluent-reviewers,flod Differential Revision: https://phabricator.services.mozilla.com/D60313
browser/components/shell/content/setDesktopBackground.xhtml
browser/locales/en-US/browser/setDesktopBackground.ftl
browser/locales/en-US/chrome/browser/setDesktopBackground.dtd
browser/locales/jar.mn
python/l10n/fluent_migrations/bug_1608167_set_desktop_background.py
--- a/browser/components/shell/content/setDesktopBackground.xhtml
+++ b/browser/components/shell/content/setDesktopBackground.xhtml
@@ -4,90 +4,92 @@
 # 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/setDesktopBackground.css" type="text/css"?>
 
 
 <!DOCTYPE dialog [
-<!ENTITY % setDesktopBackgroundDTD SYSTEM "chrome://browser/locale/setDesktopBackground.dtd">
-%setDesktopBackgroundDTD;
 #ifdef XP_MACOSX
 #include ../../../base/content/browser-doctype.inc
 #endif
 ]>
 
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
         windowtype="Shell:SetDesktopBackground"
         onload="gSetBackground.load();"
-        title="&setDesktopBackground.title;"
+        data-l10n-id="set-desktop-background-window"
         style="width: 30em;">
+
+<linkset>
+  <html:link rel="localization" href="browser/setDesktopBackground.ftl"/>
+</linkset>
+
 <dialog id="SetDesktopBackgroundDialog"
 #ifndef XP_MACOSX
         buttons="accept,cancel"
 #else
         buttons="accept"
 #endif
-        buttonlabelaccept="&setDesktopBackground.title;">
+        buttonidaccept="set-desktop-background-accept">
 
 #ifdef XP_MACOSX
 #include ../../../base/content/macWindow.inc.xhtml
 #else
     <script src="chrome://browser/content/utilityOverlay.js"/>
 #endif
 
     <stringbundle id="backgroundBundle"
                   src="chrome://browser/locale/shellservice.properties"/>
     <script src="chrome://browser/content/setDesktopBackground.js"/>
     <script src="chrome://global/content/contentAreaUtils.js"/>
 
 #ifndef XP_MACOSX
     <hbox align="center">
-      <label value="&position.label;"/>
+      <label data-l10n-id="set-background-position"/>
       <menulist id="menuPosition"
-                label="&position.label;"
                 oncommand="gSetBackground.updatePosition();">
         <menupopup>
-          <menuitem label="&center.label;"  value="CENTER"/>
-          <menuitem label="&tile.label;"    value="TILE"/>
-          <menuitem label="&stretch.label;" value="STRETCH"/>
-          <menuitem label="&fill.label;"    value="FILL"/>
-          <menuitem label="&fit.label;"     value="FIT"/>
-          <menuitem label="&span.label;"    value="SPAN" id="spanPosition"/>
+          <menuitem data-l10n-id="set-background-center"  value="CENTER"/>
+          <menuitem data-l10n-id="set-background-tile"    value="TILE"/>
+          <menuitem data-l10n-id="set-background-stretch" value="STRETCH"/>
+          <menuitem data-l10n-id="set-background-fill"    value="FILL"/>
+          <menuitem data-l10n-id="set-background-fit"     value="FIT"/>
+          <menuitem data-l10n-id="set-background-span"    value="SPAN" id="spanPosition"/>
         </menupopup>
       </menulist>
       <spacer flex="1"/>
-      <label value="&color.label;"/>
+      <label data-l10n-id="set-background-color"/>
       <html:input id="desktopColor"
                   type="color"
-                  onchange="gSetBackground.updateColor(this.value);"/> 
+                  onchange="gSetBackground.updateColor(this.value);"/>
     </hbox>
 #endif
 
     <vbox align="center">
       <!-- default to 16:9, will be adjusted to match user's actual screen -->
       <stack>
         <html:canvas id="screen" width="202" height="114" role="presentation"/>
         <vbox pack="center">
-          <html:p id="preview-unavailable" hidden="">&previewUnavailable;</html:p>
+          <html:p id="preview-unavailable" hidden="" data-l10n-id="set-background-preview-unavailable"></html:p>
         </vbox>
       </stack>
       <image id="monitor-base"/>
     </vbox>
 
 #ifdef XP_MACOSX
     <separator/>
 
     <hbox pack="end">
       <button id="setDesktopBackground"
-              label="&setDesktopBackground.title;"
+              data-l10n-id="set-desktop-background-accept"
               oncommand="gSetBackground.setDesktopBackground();"/>
       <button id="showDesktopPreferences"
-              label="&openDesktopPrefs.label;"
+              data-l10n-id="open-desktop-prefs"
               oncommand="gSetBackground.showDesktopPrefs();"
               hidden="true"/>
     </hbox>
 #endif
 
 </dialog>
 </window>
new file mode 100644
--- /dev/null
+++ b/browser/locales/en-US/browser/setDesktopBackground.ftl
@@ -0,0 +1,40 @@
+# 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/.
+
+set-desktop-background-window =
+  .title = Set Desktop Background
+
+set-desktop-background-accept =
+  .label = Set Desktop Background
+
+open-desktop-prefs =
+  .label = Open Desktop Preferences
+
+set-background-preview-unavailable = Preview unavailable
+
+# This refers to the wallpaper "spanning" multiple monitors when the
+# user has more than one. Only some of the entire image will be on
+# each monitor. This should ideally match the wording in Windows' own
+# Desktop Background settings page.
+set-background-span =
+  .label = Span
+
+set-background-color = Color:
+
+set-background-position = Position:
+
+set-background-tile =
+  .label = Tile
+
+set-background-center =
+  .label = Center
+
+set-background-stretch =
+  .label = Stretch
+
+set-background-fill =
+  .label = Fill
+
+set-background-fit =
+  .label = Fit
deleted file mode 100644
--- a/browser/locales/en-US/chrome/browser/setDesktopBackground.dtd
+++ /dev/null
@@ -1,20 +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 position.label             "Position:">
-<!ENTITY tile.label                 "Tile">
-<!ENTITY center.label               "Center">
-<!ENTITY stretch.label              "Stretch">
-<!ENTITY fill.label                 "Fill">
-<!ENTITY fit.label                  "Fit">
-<!-- LOCALIZATION NOTE (span.label): This refers to the wallpaper "spanning"
-                       multiple monitors when the user has more than one. Only
-                       some of the entire image will be on each monitor.
-                       This should ideally match the wording in Windows' own
-                       Desktop Background settings page. -->
-<!ENTITY span.label                 "Span">
-<!ENTITY color.label                "Color:">
-<!ENTITY setDesktopBackground.title "Set Desktop Background">
-<!ENTITY openDesktopPrefs.label     "Open Desktop Preferences">
-<!ENTITY previewUnavailable         "Preview unavailable">
--- a/browser/locales/jar.mn
+++ b/browser/locales/jar.mn
@@ -23,17 +23,16 @@
     locale/browser/baseMenuOverlay.dtd             (%chrome/browser/baseMenuOverlay.dtd)
     locale/browser/browser.properties              (%chrome/browser/browser.properties)
     locale/browser/customizableui/customizableWidgets.properties (%chrome/browser/customizableui/customizableWidgets.properties)
     locale/browser/uiDensity.properties            (%chrome/browser/uiDensity.properties)
     locale/browser/pocket.properties               (%chrome/browser/pocket.properties)
     locale/browser/search.properties               (%chrome/browser/search.properties)
     locale/browser/siteData.properties             (%chrome/browser/siteData.properties)
     locale/browser/sitePermissions.properties      (%chrome/browser/sitePermissions.properties)
-    locale/browser/setDesktopBackground.dtd        (%chrome/browser/setDesktopBackground.dtd)
     locale/browser/shellservice.properties         (%chrome/browser/shellservice.properties)
     locale/browser/tabbrowser.properties           (%chrome/browser/tabbrowser.properties)
     locale/browser/taskbar.properties              (%chrome/browser/taskbar.properties)
     locale/browser/translation.dtd                 (%chrome/browser/translation.dtd)
     locale/browser/translation.properties          (%chrome/browser/translation.properties)
     locale/browser/webrtcIndicator.properties      (%chrome/browser/webrtcIndicator.properties)
     locale/browser/downloads/downloads.dtd         (%chrome/browser/downloads/downloads.dtd)
     locale/browser/downloads/downloads.properties  (%chrome/browser/downloads/downloads.properties)
new file mode 100644
--- /dev/null
+++ b/python/l10n/fluent_migrations/bug_1608167_set_desktop_background.py
@@ -0,0 +1,39 @@
+# 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
+
+def migrate(ctx):
+    """Bug 1608167 - Migrate setDesktopBackground to Fluent, part {index}."""
+
+    ctx.add_transforms(
+        "browser/browser/setDesktopBackground.ftl",
+        "browser/browser/setDesktopBackground.ftl",
+    transforms_from(
+"""
+set-desktop-background-window =
+    .title = { COPY(from_path, "setDesktopBackground.title") }
+set-desktop-background-accept =
+    .label = { COPY(from_path, "setDesktopBackground.title") }
+open-desktop-prefs =
+    .label = { COPY(from_path, "openDesktopPrefs.label") }
+set-background-preview-unavailable = { COPY(from_path, "previewUnavailable") }
+set-background-span =
+    .label = { COPY(from_path, "span.label") }
+set-background-color = { COPY(from_path, "color.label") }
+set-background-position = { COPY(from_path, "position.label") }
+set-background-tile =
+    .label = { COPY(from_path, "tile.label") }
+set-background-center =
+    .label = { COPY(from_path, "center.label") }
+set-background-stretch =
+    .label = { COPY(from_path, "stretch.label") }
+set-background-fill =
+    .label = { COPY(from_path, "fill.label") }
+set-background-fit =
+    .label = { COPY(from_path, "fit.label") }
+""", from_path="browser/chrome/browser/setDesktopBackground.dtd"))