Bug 1451992 - Migrate Preferences::Subdialogs::ApplicationManager to Fluent. r?jaws,flod
MozReview-Commit-ID: JZmQtwimYsO
--- a/browser/components/preferences/applicationManager.js
+++ b/browser/components/preferences/applicationManager.js
@@ -7,29 +7,29 @@
var gAppManagerDialog = {
_removed: [],
init: function appManager_init() {
this.handlerInfo = window.arguments[0];
Services.scriptloader.loadSubScript("chrome://browser/content/preferences/in-content/main.js",
window);
var pane = gMainPane;
- var bundle = document.getElementById("appManagerBundle");
- var contentText;
- if (this.handlerInfo.type == TYPE_MAYBE_FEED)
- contentText = bundle.getString("handleWebFeeds");
- else {
- var description = pane._describeType(this.handlerInfo);
- var key =
- (this.handlerInfo.wrappedHandlerInfo instanceof Ci.nsIMIMEInfo) ? "handleFile"
- : "handleProtocol";
- contentText = bundle.getFormattedString(key, [description]);
+
+ const appDescElem = document.getElementById("appDescription");
+ if (this.handlerInfo.type == TYPE_MAYBE_FEED) {
+ document.l10n.setAttributes(appDescElem, "app-manager-handle-webfeeds");
+ } else if (this.handlerInfo.wrappedHandlerInfo instanceof Ci.nsIMIMEInfo) {
+ document.l10n.setAttributes(appDescElem, "app-manager-handle-file", {
+ type: pane._describeType(this.handlerInfo)
+ });
+ } else {
+ document.l10n.setAttributes(appDescElem, "app-manager-handle-protocol", {
+ type: pane._describeType(this.handlerInfo)
+ });
}
- contentText = bundle.getFormattedString("descriptionApplications", [contentText]);
- document.getElementById("appDescription").textContent = contentText;
var list = document.getElementById("appList");
var apps = this.handlerInfo.possibleApplicationHandlers.enumerate();
while (apps.hasMoreElements()) {
let app = apps.getNext();
if (!pane.isValidHandlerApp(app))
continue;
@@ -87,14 +87,14 @@ var gAppManagerDialog = {
var address = "";
if (app instanceof Ci.nsILocalHandlerApp)
address = app.executable.path;
else if (app instanceof Ci.nsIWebHandlerApp)
address = app.uriTemplate;
else if (app instanceof Ci.nsIWebContentHandlerInfo)
address = app.uri;
document.getElementById("appLocation").value = address;
- var bundle = document.getElementById("appManagerBundle");
- var appType = app instanceof Ci.nsILocalHandlerApp ? "descriptionLocalApp"
- : "descriptionWebApp";
- document.getElementById("appType").value = bundle.getString(appType);
+ const l10nId = app instanceof Ci.nsILocalHandlerApp ? "app-manager-local-app-info"
+ : "app-manager-web-app-info";
+ const appTypeElem = document.getElementById("appType");
+ document.l10n.setAttributes(appTypeElem, l10nId);
}
};
--- a/browser/components/preferences/applicationManager.xul
+++ b/browser/components/preferences/applicationManager.xul
@@ -1,27 +1,28 @@
<?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/"?>
-<!DOCTYPE dialog SYSTEM "chrome://browser/locale/preferences/applicationManager.dtd">
-
<dialog id="appManager"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
buttons="accept,cancel"
onload="gAppManagerDialog.init();"
ondialogaccept="gAppManagerDialog.onOK();"
ondialogcancel="gAppManagerDialog.onCancel();"
- title="&appManager.title;"
- style="&appManager.style;"
+ data-l10n-id="app-manager-window"
+ data-l10n-attrs="title, style"
persist="screenX screenY">
+ <link rel="localization" href="browser/preferences/applicationManager.ftl"/>
+ <script type="application/javascript" src="chrome://global/content/l10n.js"></script>
+
<script type="application/javascript"
src="chrome://browser/content/utilityOverlay.js"/>
<script type="application/javascript"
src="chrome://global/content/preferencesBindings.js"/>
<script type="application/javascript"
src="chrome://browser/content/preferences/applicationManager.js"/>
<commandset id="appManagerCommandSet">
@@ -29,31 +30,27 @@
oncommand="gAppManagerDialog.remove();"
disabled="true"/>
</commandset>
<keyset id="appManagerKeyset">
<key id="delete" keycode="VK_DELETE" command="cmd_remove"/>
</keyset>
- <stringbundleset id="appManagerBundleset">
- <stringbundle id="appManagerBundle"
- src="chrome://browser/locale/preferences/applicationManager.properties"/>
- </stringbundleset>
-
- <description id="appDescription"/>
+ <!-- The   character is required here to calculate the dialog height -->
+ <description id="appDescription"> </description>
<separator class="thin"/>
<hbox flex="1">
<listbox id="appList" onselect="gAppManagerDialog.onSelect();" flex="1"/>
<vbox>
<button id="remove"
- label="&remove.label;"
- accesskey="&remove.accesskey;"
+ data-l10n-id="app-manager-remove"
command="cmd_remove"/>
<spacer flex="1"/>
</vbox>
</hbox>
<vbox id="appDetails">
<separator class="thin"/>
- <label id="appType"/>
+ <!-- The   character is required here to calculate the dialog height -->
+ <label id="appType"> </label>
<textbox id="appLocation" readonly="true" class="plain"/>
</vbox>
</dialog>
--- a/browser/components/preferences/in-content/preferences.xul
+++ b/browser/components/preferences/in-content/preferences.xul
@@ -97,21 +97,16 @@
src="chrome://branding/locale/brand.properties"/>
<stringbundle id="bundlePreferences"
src="chrome://browser/locale/preferences/preferences.properties"/>
<stringbundle id="pkiBundle"
src="chrome://pippki/locale/pippki.properties"/>
<stringbundle id="browserBundle"
src="chrome://browser/locale/browser.properties"/>
- <stringbundleset id="appManagerBundleset">
- <stringbundle id="appManagerBundle"
- src="chrome://browser/locale/preferences/applicationManager.properties"/>
- </stringbundleset>
-
<stack flex="1">
<hbox flex="1">
<vbox class="navigation">
<!-- category list -->
<richlistbox id="categories">
<richlistitem id="category-general"
class="category"
new file mode 100644
--- /dev/null
+++ b/browser/locales/en-US/browser/preferences/applicationManager.ftl
@@ -0,0 +1,27 @@
+# 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/.
+
+app-manager-window =
+ .title = Application details
+ .style = width: 30em; min-height: 20em;
+
+app-manager-remove =
+ .label = Remove
+ .accesskey = R
+
+app-manager-handle-webfeeds = The following applications can be used to handle Web Feeds.
+
+# Variables:
+# $type (String) - the URI scheme of the link (e.g. mailto:)
+app-manager-handle-protocol = The following applications can be used to handle { $type } links.
+
+# Variables:
+# $type (String) - the MIME type (e.g. application/binary)
+app-manager-handle-file = The following applications can be used to handle { $type } content.
+
+## These strings are followed, on a new line,
+## by the URL or path of the application.
+
+app-manager-web-app-info = This web application is hosted at:
+app-manager-local-app-info = This application is located at:
deleted file mode 100644
--- a/browser/locales/en-US/chrome/browser/preferences/applicationManager.dtd
+++ /dev/null
@@ -1,8 +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 appManager.title "Application details">
-<!ENTITY appManager.style "width: 30em; min-height: 20em;">
-<!ENTITY remove.label "Remove">
-<!ENTITY remove.accesskey "R">
deleted file mode 100644
--- a/browser/locales/en-US/chrome/browser/preferences/applicationManager.properties
+++ /dev/null
@@ -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/.
-
-# LOCALIZATION NOTE
-# in descriptionApplications, %S will be replaced by one of the 3 following strings
-descriptionApplications=The following applications can be used to handle %S.
-
-handleProtocol=%S links
-handleWebFeeds=Web Feeds
-handleFile=%S content
-
-descriptionWebApp=This web application is hosted at:
-descriptionLocalApp=This application is located at:
--- a/browser/locales/jar.mn
+++ b/browser/locales/jar.mn
@@ -50,18 +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/applicationManager.dtd (%chrome/browser/preferences/applicationManager.dtd)
- locale/browser/preferences/applicationManager.properties (%chrome/browser/preferences/applicationManager.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)
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)
new file mode 100644
--- /dev/null
+++ b/python/l10n/fluent_migrations/bug_1451992_preferences_applicationManager.py
@@ -0,0 +1,116 @@
+# 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 EXTERNAL_ARGUMENT
+from fluent.migrate import COPY, REPLACE
+
+def migrate(ctx):
+ """Bug 1451992 - Migrate Preferences::Subdialogs::ApplicationManager to Fluent, part {index}."""
+
+ ctx.add_transforms(
+ 'browser/browser/preferences/applicationManager.ftl',
+ 'browser/browser/preferences/applicationManager.ftl',
+ [
+ FTL.Message(
+ id=FTL.Identifier('app-manager-window'),
+ attributes=[
+ FTL.Attribute(
+ FTL.Identifier('title'),
+ COPY(
+ 'browser/chrome/browser/preferences/applicationManager.dtd',
+ 'appManager.title',
+ ),
+ ),
+ FTL.Attribute(
+ FTL.Identifier('style'),
+ COPY(
+ 'browser/chrome/browser/preferences/applicationManager.dtd',
+ 'appManager.style',
+ ),
+ ),
+ ],
+ ),
+ FTL.Message(
+ id=FTL.Identifier('app-manager-remove'),
+ attributes=[
+ FTL.Attribute(
+ FTL.Identifier('label'),
+ COPY(
+ 'browser/chrome/browser/preferences/applicationManager.dtd',
+ 'remove.label',
+ ),
+ ),
+ FTL.Attribute(
+ FTL.Identifier('accesskey'),
+ COPY(
+ 'browser/chrome/browser/preferences/applicationManager.dtd',
+ 'remove.accesskey',
+ ),
+ ),
+ ],
+ ),
+ FTL.Message(
+ id=FTL.Identifier('app-manager-handle-webfeeds'),
+ value=REPLACE(
+ 'browser/chrome/browser/preferences/applicationManager.properties',
+ 'descriptionApplications',
+ {
+ '%S': COPY(
+ 'browser/chrome/browser/preferences/applicationManager.properties',
+ 'handleWebFeeds',
+ )
+ }
+ ),
+ ),
+ FTL.Message(
+ id=FTL.Identifier('app-manager-handle-protocol'),
+ value=REPLACE(
+ 'browser/chrome/browser/preferences/applicationManager.properties',
+ 'descriptionApplications',
+ {
+ '%S': REPLACE(
+ 'browser/chrome/browser/preferences/applicationManager.properties',
+ 'handleProtocol',
+ {
+ '%S': EXTERNAL_ARGUMENT('type')
+ }
+ )
+ }
+ ),
+ ),
+ FTL.Message(
+ id=FTL.Identifier('app-manager-handle-file'),
+ value=REPLACE(
+ 'browser/chrome/browser/preferences/applicationManager.properties',
+ 'descriptionApplications',
+ {
+ '%S': REPLACE(
+ 'browser/chrome/browser/preferences/applicationManager.properties',
+ 'handleFile',
+ {
+ '%S': EXTERNAL_ARGUMENT('type')
+ }
+ )
+ }
+ ),
+ ),
+ FTL.Message(
+ id=FTL.Identifier('app-manager-web-app-info'),
+ value=COPY(
+ 'browser/chrome/browser/preferences/applicationManager.properties',
+ 'descriptionWebApp',
+ ),
+ ),
+ FTL.Message(
+ id=FTL.Identifier('app-manager-local-app-info'),
+ value=COPY(
+ 'browser/chrome/browser/preferences/applicationManager.properties',
+ 'descriptionLocalApp',
+ ),
+ ),
+ ]
+ )