Bug 1451992 - Migrate Preferences::Subdialogs::Blocklists to Fluent. r=gijs,flod

MozReview-Commit-ID: IXacqfUnZ2q

--HG--
extra : amend_source : dfa7ab6d368a5b5564c48a2013ad40d7869fc607
This commit is contained in:
Zibi Braniecki 2018-04-03 04:29:25 +02:00
parent b423327766
commit 529d7466ef
10 changed files with 150 additions and 51 deletions

View File

@ -12,7 +12,6 @@ const LISTS_PREF_BRANCH = "browser.safebrowsing.provider.mozilla.lists.";
var gBlocklistManager = {
_type: "",
_blockLists: [],
_brandShortName: null,
_bundle: null,
_tree: null,
@ -75,15 +74,6 @@ var gBlocklistManager = {
}
this._type = "tracking";
this._brandShortName = params.brandShortName;
let blocklistsText = document.getElementById("blocklistsText");
while (blocklistsText.hasChildNodes()) {
blocklistsText.firstChild.remove();
}
blocklistsText.appendChild(document.createTextNode(params.introText));
document.title = params.windowTitle;
this._loadBlockLists();
},

View File

@ -7,18 +7,20 @@
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?>
<!DOCTYPE dialog SYSTEM "chrome://browser/locale/preferences/blocklists.dtd" >
<window id="BlocklistsDialog" class="windowDialog"
windowtype="Browser:Blocklists"
title="&window.title;"
data-l10n-id="blocklist-window"
data-l10n-attrs="title, style"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
style="width: &window.width;;"
onload="gBlocklistManager.onLoad();"
onunload="gBlocklistManager.uninit();"
persist="screenX screenY width height"
onkeypress="gBlocklistManager.onWindowKeyPress(event);">
<link rel="localization" href="branding/brand.ftl"/>
<link rel="localization" href="browser/preferences/blocklists.ftl"/>
<script type="application/javascript" src="chrome://global/content/l10n.js"></script>
<script src="chrome://global/content/treeUtils.js"/>
<script src="chrome://browser/content/preferences/blocklists.js"/>
@ -26,11 +28,11 @@
src="chrome://browser/locale/preferences/preferences.properties"/>
<keyset>
<key key="&windowClose.key;" modifiers="accel" oncommand="window.close();"/>
<key data-l10n-id="blocklist-close-key" modifiers="accel" oncommand="window.close();"/>
</keyset>
<vbox class="contentPane largeDialogContainer" flex="1">
<description id="blocklistsText" control="url"/>
<description id="blocklistsText" data-l10n-id="blocklist-desc" control="url"/>
<separator class="thin"/>
<tree id="blocklistsTree" flex="1" style="height: 18em;"
hidecolumnpicker="true"
@ -38,7 +40,7 @@
<treecols>
<treecol id="selectionCol" label="" flex="1" sortable="false"
type="checkbox"/>
<treecol id="listCol" label="&treehead.list.label;" flex="80"
<treecol id="listCol" data-l10n-id="blocklist-treehead-list" flex="80"
sortable="false"/>
</treecols>
<treechildren/>
@ -48,9 +50,9 @@
<spacer flex="1"/>
<hbox class="actionButtons" align="right" flex="1">
<button oncommand="close();" icon="close"
label="&button.cancel.label;" accesskey="&button.cancel.accesskey;" />
data-l10n-id="blocklist-button-cancel"/>
<button id="btnApplyChanges" oncommand="gBlocklistManager.onApplyChanges();" icon="save"
label="&button.ok.label;" accesskey="&button.ok.accesskey;"/>
data-l10n-id="blocklist-button-ok"/>
</hbox>
</vbox>
</window>

View File

@ -77,6 +77,8 @@
<link rel="localization" href="branding/brand.ftl"/>
<link rel="localization" href="browser/branding/sync-brand.ftl"/>
<link rel="localization" href="browser/preferences/preferences.ftl"/>
<link rel="localization" href="browser/preferences/blocklists.ftl"/>
<script type="text/javascript" src="chrome://global/content/l10n.js"></script>
<html:link rel="shortcut icon"

View File

@ -404,10 +404,6 @@ var gPrivacyPane = {
bundlePrefs.getString("trackingprotectionpermissionstitle"),
bundlePrefs.getString("trackingprotectionpermissionstext2"),
]);
appendSearchKeywords("changeBlockList", [
bundlePrefs.getString("blockliststitle"),
bundlePrefs.getString("blockliststext"),
]);
appendSearchKeywords("popupPolicyButton", [
bundlePrefs.getString("popuppermissionstitle2"),
bundlePrefs.getString("popuppermissionstext"),
@ -791,16 +787,7 @@ var gPrivacyPane = {
* Displays the available block lists for tracking protection.
*/
showBlockLists() {
var bundlePreferences = document.getElementById("bundlePreferences");
let brandName = document.getElementById("bundleBrand")
.getString("brandShortName");
var params = {
brandShortName: brandName,
windowTitle: bundlePreferences.getString("blockliststitle"),
introText: bundlePreferences.getString("blockliststext")
};
gSubDialog.open("chrome://browser/content/preferences/blocklists.xul",
null, params);
gSubDialog.open("chrome://browser/content/preferences/blocklists.xul", null);
},
// COOKIES AND SITE DATA

View File

@ -347,7 +347,7 @@
flex="1"
data-l10n-id="tracking-change-block-list"
preference="pref.privacy.disable_button.change_blocklist"
searchkeywords="&button.cancel.label; &button.ok.label;"/>
search-l10n-ids="blocklist-window.title, blocklist-desc, blocklist-button-cancel.label, blocklist-button-ok.label"/>
</hbox>
</vbox>
</hbox>

View File

@ -0,0 +1,22 @@
# 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/.
blocklist-window =
.title = Block Lists
.style = width: 55em
blocklist-desc = You can choose which list { -brand-short-name } will use to block Web elements that may track your browsing activity.
blocklist-close-key =
.key = w
blocklist-treehead-list =
.label = List
blocklist-button-cancel =
.label = Cancel
.accesskey = C
blocklist-button-ok =
.label = Save Changes
.accesskey = S

View File

@ -1,14 +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 "Block Lists">
<!ENTITY window.width "55em">
<!ENTITY treehead.list.label "List">
<!ENTITY windowClose.key "w">
<!ENTITY button.cancel.label "Cancel">
<!ENTITY button.cancel.accesskey "C">
<!ENTITY button.ok.label "Save Changes">
<!ENTITY button.ok.accesskey "S">

View File

@ -51,8 +51,6 @@ savedLoginsExceptions_desc3=Logins for the following websites will not be saved
#### Block List Manager
blockliststext=You can choose which list Firefox will use to block Web elements that may track your browsing activity.
blockliststitle=Block Lists
# LOCALIZATION NOTE (mozNameTemplate): This template constructs the name of the
# block list in the block lists dialog. It combines the list name and
# description.

View File

@ -55,7 +55,6 @@
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/blocklists.dtd (%chrome/browser/preferences/blocklists.dtd)
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)

View File

@ -0,0 +1,113 @@
# 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::Blocklists to Fluent, part {index}."""
ctx.add_transforms(
'browser/browser/preferences/blocklists.ftl',
'browser/browser/preferences/blocklists.ftl',
[
FTL.Message(
id=FTL.Identifier('blocklist-window'),
attributes=[
FTL.Attribute(
FTL.Identifier('title'),
COPY(
'browser/chrome/browser/preferences/blocklists.dtd',
'window.title',
),
),
FTL.Attribute(
FTL.Identifier('style'),
CONCAT(
FTL.TextElement('width: '),
COPY(
'browser/chrome/browser/preferences/blocklists.dtd',
'window.width'
)
)
),
],
),
FTL.Message(
id=FTL.Identifier('blocklist-desc'),
value=REPLACE(
'browser/chrome/browser/preferences/preferences.properties',
'blockliststext',
{
'Firefox': MESSAGE_REFERENCE('-brand-short-name')
},
),
),
FTL.Message(
id=FTL.Identifier('blocklist-close-key'),
attributes=[
FTL.Attribute(
FTL.Identifier('key'),
COPY(
'browser/chrome/browser/preferences/blocklists.dtd',
'windowClose.key',
),
),
],
),
FTL.Message(
id=FTL.Identifier('blocklist-treehead-list'),
attributes=[
FTL.Attribute(
FTL.Identifier('label'),
COPY(
'browser/chrome/browser/preferences/blocklists.dtd',
'treehead.list.label',
),
),
],
),
FTL.Message(
id=FTL.Identifier('blocklist-button-cancel'),
attributes=[
FTL.Attribute(
FTL.Identifier('label'),
COPY(
'browser/chrome/browser/preferences/blocklists.dtd',
'button.cancel.label',
),
),
FTL.Attribute(
FTL.Identifier('accesskey'),
COPY(
'browser/chrome/browser/preferences/blocklists.dtd',
'button.cancel.accesskey',
),
),
],
),
FTL.Message(
id=FTL.Identifier('blocklist-button-ok'),
attributes=[
FTL.Attribute(
FTL.Identifier('label'),
COPY(
'browser/chrome/browser/preferences/blocklists.dtd',
'button.ok.label',
),
),
FTL.Attribute(
FTL.Identifier('accesskey'),
COPY(
'browser/chrome/browser/preferences/blocklists.dtd',
'button.ok.accesskey',
),
),
],
),
]
)