From 0f0e2e06e2d7c80da9ea51e6f8b4d7ad92d0529d Mon Sep 17 00:00:00 2001 From: Qinghao_Jack_Song Date: Wed, 31 Oct 2018 16:11:30 +0000 Subject: [PATCH] Bug 1497694 - Migrate Update History in Update section of Preferences to use Fluent for localization r=Gijs,flod,zbraniecki,jaws Differential Revision: https://phabricator.services.mozilla.com/D8045 --HG-- extra : moz-landing-system : lando --- .../preferences/in-content/main.xul | 5 +- .../preferences/in-content/preferences.xul | 3 +- .../tests/browser_advanced_update.js | 7 ++- .../bug_1497687_updateHistory_preferences.py | 58 +++++++++++++++++++ .../en-US/chrome/mozapps/update/history.dtd | 16 ----- .../chrome/mozapps/update/updates.properties | 5 -- .../locales/en-US/toolkit/updates/history.ftl | 24 ++++++++ toolkit/locales/jar.mn | 1 - toolkit/mozapps/update/content/history.js | 6 +- toolkit/mozapps/update/content/history.xul | 22 +++---- 10 files changed, 103 insertions(+), 44 deletions(-) create mode 100644 python/l10n/fluent_migrations/bug_1497687_updateHistory_preferences.py delete mode 100644 toolkit/locales/en-US/chrome/mozapps/update/history.dtd create mode 100644 toolkit/locales/en-US/toolkit/updates/history.ftl diff --git a/browser/components/preferences/in-content/main.xul b/browser/components/preferences/in-content/main.xul index cb9ef156f31c..d74d3484bc39 100644 --- a/browser/components/preferences/in-content/main.xul +++ b/browser/components/preferences/in-content/main.xul @@ -459,7 +459,10 @@ class="accessory-button" data-l10n-id="update-history" preference="app.update.disable_button.showUpdateHistory" - searchkeywords="&history.title; &history2.intro;"/> + search-l10n-ids=" + history-title, + history-intro + "/> #endif diff --git a/browser/components/preferences/in-content/preferences.xul b/browser/components/preferences/in-content/preferences.xul index 40884211ef77..7c244760d437 100644 --- a/browser/components/preferences/in-content/preferences.xul +++ b/browser/components/preferences/in-content/preferences.xul @@ -18,14 +18,12 @@ - %aboutDialogDTD; %brandDTD; -%historyDTD; %certManagerDTD; %deviceManangerDTD; %sanitizeDTD; @@ -52,6 +50,7 @@ + - - - - - - - - - - - - - diff --git a/toolkit/locales/en-US/chrome/mozapps/update/updates.properties b/toolkit/locales/en-US/chrome/mozapps/update/updates.properties index 90a891d83492..2866b859385c 100644 --- a/toolkit/locales/en-US/chrome/mozapps/update/updates.properties +++ b/toolkit/locales/en-US/chrome/mozapps/update/updates.properties @@ -2,11 +2,6 @@ # 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/. -# LOCALIZATION NOTE: The 1st %S is the update name and the 2nd %S is the build -# identifier from the local updates.xml for displaying update history -# example: MyApplication (20081022033543) -updateFullName=%S (%S) - # LOCALIZATION NOTE: The 1st %S is brandShortName and 2nd %S is update version # where update version from the update xml # example: MyApplication 10.0.5 diff --git a/toolkit/locales/en-US/toolkit/updates/history.ftl b/toolkit/locales/en-US/toolkit/updates/history.ftl new file mode 100644 index 000000000000..8108a0fda07a --- /dev/null +++ b/toolkit/locales/en-US/toolkit/updates/history.ftl @@ -0,0 +1,24 @@ +# 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/. + +history-title = Update History +history-intro = The following updates have been installed + +close-button-label = + .buttonlabelcancel = Close + .title = Update History + +no-updates-label = No updates installed yet +name-header = Update Name +date-header = Install Date +type-header = Type +state-header = State + +# Used to display update history +# +# Variables: +# $name (String): name of the update +# $buildID (String): build identifier from the local updates.xml +update-full-name = + .name = { $name } ({ $buildID }) diff --git a/toolkit/locales/jar.mn b/toolkit/locales/jar.mn index 9702274f0c4e..b823d47bc8e8 100644 --- a/toolkit/locales/jar.mn +++ b/toolkit/locales/jar.mn @@ -98,7 +98,6 @@ 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/@AB_CD@/mozapps/update/history.dtd (%chrome/mozapps/update/history.dtd) % locale pluginproblem @AB_CD@ %locale/@AB_CD@/pluginproblem/ locale/@AB_CD@/pluginproblem/pluginproblem.dtd (%chrome/pluginproblem/pluginproblem.dtd) % locale alerts @AB_CD@ %locale/@AB_CD@/alerts/ diff --git a/toolkit/mozapps/update/content/history.js b/toolkit/mozapps/update/content/history.js index 505ffb5f042d..b12592b74641 100644 --- a/toolkit/mozapps/update/content/history.js +++ b/toolkit/mozapps/update/content/history.js @@ -20,8 +20,6 @@ var gUpdateHistory = { while (this._view.hasChildNodes()) this._view.firstChild.remove(); - var bundle = document.getElementById("updateBundle"); - for (var i = 0; i < uc; ++i) { var update = um.getUpdateAt(i); @@ -36,8 +34,8 @@ var gUpdateHistory = { var element = document.createXULElement("richlistitem"); element.className = "update"; this._view.appendChild(element); - element.name = bundle.getFormattedString("updateFullName", - [update.name, update.buildID]); + element.setAttribute("data-l10n-attrs", "name"); + document.l10n.setAttributes(element, "update-full-name", { name: update.name, buildID: update.buildID}); element.installDate = this._formatDate(update.installDate); if (update.detailsURL) element.detailsURL = update.detailsURL; diff --git a/toolkit/mozapps/update/content/history.xul b/toolkit/mozapps/update/content/history.xul index eb9be4899c2f..b7292a556f55 100644 --- a/toolkit/mozapps/update/content/history.xul +++ b/toolkit/mozapps/update/content/history.xul @@ -4,12 +4,7 @@ - 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/. --> - - -%historyDTD; -%brandDTD; -]> + @@ -20,20 +15,21 @@ style="width: 35em;" buttons="cancel" defaultButton="cancel" - buttonlabelcancel="&closebutton.label;" - title="&history.title;" + data-l10n-id="close-button-label" + data-l10n-attrs="buttonlabelcancel" onload="gUpdateHistory.onLoad();"> + + + +