Bug 1502396 - Convert change and remove master password dialogs in about:preferences to use Fluent r=jaws,Gijs,flod
authorJack Smith <jack@jackdeansmith.com>
Tue, 06 Nov 2018 21:39:17 +0000
changeset 503165 0f600f20a907fd385895ea362b62d0876672d78c
parent 503164 9135ee87f8d9cc7b6257ca3d84976d433200f600
child 503166 37d0de33af7f2f2086a0a1eb3d3662f2a6921962
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws, Gijs, flod
bugs1502396
milestone65.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 1502396 - Convert change and remove master password dialogs in about:preferences to use Fluent r=jaws,Gijs,flod Differential Revision: https://phabricator.services.mozilla.com/D10949
python/l10n/fluent_migrations/bug_1502396_changemp_removemp.py
toolkit/locales/en-US/chrome/mozapps/preferences/changemp.dtd
toolkit/locales/en-US/chrome/mozapps/preferences/removemp.dtd
toolkit/locales/en-US/toolkit/preferences/preferences.ftl
toolkit/locales/jar.mn
toolkit/mozapps/preferences/changemp.xul
toolkit/mozapps/preferences/removemp.xul
new file mode 100644
--- /dev/null
+++ b/python/l10n/fluent_migrations/bug_1502396_changemp_removemp.py
@@ -0,0 +1,44 @@
+# 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
+
+
+def migrate(ctx):
+    """Bug 1502396 - Convert change and remove master password dialogs in about:preferences to use Fluent"""
+
+    ctx.add_transforms(
+        "toolkit/toolkit/preferences/preferences.ftl",
+        "toolkit/toolkit/preferences/preferences.ftl",
+        transforms_from(
+            """
+set-password =
+    .title = { COPY(from_path, "setPassword.title") }
+set-password-old-password = { COPY(from_path, "setPassword.oldPassword.label") }
+set-password-new-password = { COPY(from_path, "setPassword.newPassword.label") }
+set-password-reenter-password = { COPY(from_path, "setPassword.reenterPassword.label") }
+set-password-meter = { COPY(from_path, "setPassword.meter.label") }
+set-password-meter-loading = { COPY(from_path, "setPassword.meter.loading") }
+master-password-description = { COPY(from_path, "masterPasswordDescription.label") }
+master-password-warning = { COPY(from_path, "masterPasswordWarning.label") }
+""", from_path="toolkit/chrome/mozapps/preferences/changemp.dtd"))
+
+    ctx.add_transforms(
+        "toolkit/toolkit/preferences/preferences.ftl",
+        "toolkit/toolkit/preferences/preferences.ftl",
+        transforms_from(
+            """
+remove-password =
+    .title = { COPY(from_path, "removePassword.title") }
+remove-info =
+    .label = { COPY(from_path, "removeInfo.label") }
+remove-warning1 = { COPY(from_path, "removeWarning1.label") }
+remove-warning2 = { COPY(from_path, "removeWarning2.label") }
+remove-password-old-password =
+    .label = { COPY(from_path, "setPassword.oldPassword.label") }
+""", from_path="toolkit/chrome/mozapps/preferences/removemp.dtd"))
deleted file mode 100644
--- a/toolkit/locales/en-US/chrome/mozapps/preferences/changemp.dtd
+++ /dev/null
@@ -1,13 +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 setPassword.title                 "Change Master Password">
-<!ENTITY setPassword.tokenName.label       "Security Device">
-<!ENTITY setPassword.oldPassword.label     "Current password:">
-<!ENTITY setPassword.newPassword.label     "Enter new password:">
-<!ENTITY setPassword.reenterPassword.label "Re-enter password:">
-<!ENTITY setPassword.meter.label           "Password quality meter">
-<!ENTITY setPassword.meter.loading         "Loading">
-<!ENTITY masterPasswordDescription.label   "A Master Password is used to protect sensitive information like site passwords.  If you create a Master Password you will be asked to enter it once per session when &brandShortName; retrieves saved information protected by the password.">
-<!ENTITY masterPasswordWarning.label       "Please make sure you remember the Master Password you have set.  If you forget your Master Password, you will be unable to access any of the information protected by it.">
deleted file mode 100644
--- a/toolkit/locales/en-US/chrome/mozapps/preferences/removemp.dtd
+++ /dev/null
@@ -1,10 +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 removePassword.title              "Remove Master Password">
-<!ENTITY removeInfo.label                  "You must enter your current password to proceed:">
-<!ENTITY removeWarning1.label              "Your Master Password is used to protect sensitive information like site passwords.">
-<!ENTITY removeWarning2.label              "If you remove your Master Password your information will not be protected if your computer is compromised.">
-<!ENTITY setPassword.oldPassword.label     "Current password:">
-
--- a/toolkit/locales/en-US/toolkit/preferences/preferences.ftl
+++ b/toolkit/locales/en-US/toolkit/preferences/preferences.ftl
@@ -13,8 +13,27 @@ pw-empty-warning = Your stored web and e
 pw-erased-ok = You have deleted your Master Password. { pw-empty-warning }
 pw-not-wanted = Warning! You have decided not to use a Master Password. { pw-empty-warning }
 
 pw-change2empty-in-fips-mode = You are currently in FIPS mode. FIPS requires a non-empty Master Password.
 pw-change-success-title = Password Change Succeeded
 pw-change-failed-title = Password Change Failed
 pw-remove-button =
     .label = Remove
+
+set-password =
+    .title = Change Master Password
+set-password-old-password = Current password:
+set-password-new-password = Enter new password:
+set-password-reenter-password = Re-enter password:
+set-password-meter = Password quality meter
+set-password-meter-loading = Loading
+master-password-description = A Master Password is used to protect sensitive information like site passwords. If you create a Master Password you will be asked to enter it once per session when { -brand-short-name } retrieves saved information protected by the password.
+master-password-warning = Please make sure you remember the Master Password you have set. If you forget your Master Password, you will be unable to access any of the information protected by it.
+
+remove-password =
+    .title = Remove Master Password
+remove-info =
+    .label = You must enter your current password to proceed:
+remove-warning1 = Your Master Password is used to protect sensitive information like site passwords.
+remove-warning2 = If you remove your Master Password your information will not be protected if your computer is compromised.
+remove-password-old-password =
+    .label = Current password:
--- a/toolkit/locales/jar.mn
+++ b/toolkit/locales/jar.mn
@@ -82,18 +82,16 @@
   locale/@AB_CD@/mozapps/downloads/downloads.properties           (%chrome/mozapps/downloads/downloads.properties)
   locale/@AB_CD@/mozapps/extensions/extensions.dtd                (%chrome/mozapps/extensions/extensions.dtd)
 #ifndef MOZ_FENNEC
   locale/@AB_CD@/mozapps/extensions/extensions.properties         (%chrome/mozapps/extensions/extensions.properties)
   locale/@AB_CD@/mozapps/extensions/blocklist.dtd                 (%chrome/mozapps/extensions/blocklist.dtd)
 #endif
   locale/@AB_CD@/mozapps/handling/handling.dtd                    (%chrome/mozapps/handling/handling.dtd)
   locale/@AB_CD@/mozapps/handling/handling.properties             (%chrome/mozapps/handling/handling.properties)
-  locale/@AB_CD@/mozapps/preferences/changemp.dtd                 (%chrome/mozapps/preferences/changemp.dtd)
-  locale/@AB_CD@/mozapps/preferences/removemp.dtd                 (%chrome/mozapps/preferences/removemp.dtd)
   locale/@AB_CD@/mozapps/profile/createProfileWizard.dtd          (%chrome/mozapps/profile/createProfileWizard.dtd)
   locale/@AB_CD@/mozapps/profile/profileSelection.properties      (%chrome/mozapps/profile/profileSelection.properties)
   locale/@AB_CD@/mozapps/profile/profileSelection.dtd             (%chrome/mozapps/profile/profileSelection.dtd)
 #ifndef MOZ_FENNEC
   locale/@AB_CD@/mozapps/update/updates.dtd                       (%chrome/mozapps/update/updates.dtd)
   locale/@AB_CD@/mozapps/update/updates.properties                (%chrome/mozapps/update/updates.properties)
 #endif
 % locale pluginproblem @AB_CD@ %locale/@AB_CD@/pluginproblem/
--- a/toolkit/mozapps/preferences/changemp.xul
+++ b/toolkit/mozapps/preferences/changemp.xul
@@ -1,66 +1,61 @@
 <?xml version="1.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/. -->
 
 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
 
-<!DOCTYPE dialog [
-<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
-<!ENTITY % changempDTD SYSTEM "chrome://mozapps/locale/preferences/changemp.dtd" >
-%brandDTD;
-%changempDTD;
-]>
-
-<dialog id="changemp" title="&setPassword.title;"
+<dialog id="changemp"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         xmlns:html="http://www.w3.org/1999/xhtml"
-        style="width: 40em;" 
+        style="width: 40em;"
         ondialogaccept="setPassword();"
-        onload="init()">
+        onload="init()"
+        data-l10n-id="set-password">
 
   <script type="application/javascript" src="chrome://mozapps/content/preferences/changemp.js"/>
 
   <linkset>
+    <link rel="localization" href="branding/brand.ftl"/>
     <link rel="localization" href="toolkit/preferences/preferences.ftl"/>
   </linkset>
 
-  <description control="pw1">&masterPasswordDescription.label;</description>
+  <description control="pw1" data-l10n-id="master-password-description"></description>
 
   <grid>
     <columns>
       <column flex="1"/>
       <column/>
     </columns>
     <rows>
       <row>
-        <label control="oldpw">&setPassword.oldPassword.label;</label>
+        <label control="oldpw" data-l10n-id="set-password-old-password"></label>
         <textbox id="oldpw" type="password"/>
         <!-- This textbox is inserted as a workaround to the fact that making the 'type'
               & 'disabled' property of the 'oldpw' textbox toggle between ['password' &
               'false'] and ['text' & 'true'] - as would be necessary if the menu has more
               than one tokens, some initialized and some not - does not work properly. So,
               either the textbox 'oldpw' or the textbox 'message' would be displayed,
               depending on the state of the token selected
         -->
         <textbox id="message" disabled="true" />
       </row>
       <row>
-        <label control="pw1">&setPassword.newPassword.label;</label>
+        <label control="pw1" data-l10n-id="set-password-new-password"></label>
         <textbox id="pw1" type="password"
                  oninput="setPasswordStrength(); checkPasswords();"/>
       </row>
       <row>
-        <label control="pw2">&setPassword.reenterPassword.label;</label>
+        <label control="pw2" data-l10n-id="set-password-reenter-password"></label>
         <textbox id="pw2" type="password" oninput="checkPasswords();"/>
       </row>
     </rows>
   </grid>
 
-  <html:label for="pwmeter" style="display: -moz-box;">&setPassword.meter.label;</html:label>
+  <html:label for="pwmeter" style="display: -moz-box;" data-l10n-id="set-password-meter"></html:label>
   <html:progress id="pwmeter" value="0" max="100"/>
 
-  <description control="pw2" class="header">&masterPasswordWarning.label;</description>
+  <description control="pw2" class="header" data-l10n-id="master-password-warning"></description>
 
 </dialog>
--- a/toolkit/mozapps/preferences/removemp.xul
+++ b/toolkit/mozapps/preferences/removemp.xul
@@ -1,47 +1,41 @@
 <?xml version="1.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/. -->
 
 
 <?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
 
-<!DOCTYPE dialog [
-<!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd" >
-<!ENTITY % removempDTD SYSTEM "chrome://mozapps/locale/preferences/removemp.dtd" >
-%brandDTD;
-%removempDTD;
-]>
-
-<dialog id="removemp" title="&removePassword.title;"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" 
+<dialog id="removemp"
+        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         style="width: 35em;" 
         ondialogaccept="gRemovePasswordDialog.removePassword();" 
-        onload="gRemovePasswordDialog.init()">
+        onload="gRemovePasswordDialog.init()"
+        data-l10n-id="remove-password">
 
   <script type="application/javascript" src="chrome://mozapps/content/preferences/removemp.js"/>
 
   <linkset>
     <link rel="localization" href="toolkit/preferences/preferences.ftl"/>
   </linkset>
 
   <vbox id="warnings">
-    <description>&removeWarning1.label;</description>
-    <description class="header">&removeWarning2.label;</description>
+    <description data-l10n-id="remove-warning1"></description>
+    <description class="header" data-l10n-id="remove-warning2"></description>
   </vbox>
-  
+
   <separator class="thin"/>
-    
+
   <groupbox>
-    <caption label="&removeInfo.label;"/>
+    <caption  data-l10n-id="remove-info"/>
 
     <hbox align="center">
-      <label control="password" value="&setPassword.oldPassword.label;"/> 
+      <label control="password" data-l10n-id="remove-password-old-password"/> 
       <textbox id="password" type="password"
                oninput="gRemovePasswordDialog.validateInput();"
                aria-describedby="warnings"/>
     </hbox>
   </groupbox>
   
   <separator/>