Bug 1733495 - Migrate plugins.properties to aboutPlugins.ftl. r=Gijs,fluent-reviewers,nbaumgardner,kpatenio
authorEemeli Aro <eemeli@gmail.com>
Mon, 22 Nov 2021 09:16:25 +0000
changeset 599760 456c78b34382def926ba402b77ea12b39d642ce4
parent 599759 66396b50cbabe8ff5cf70e2ae99a8a8652f19d57
child 599761 5a2cefe99395667e6e2c4dc01b8ea9fd0915fd32
push id38999
push userimoraru@mozilla.com
push dateMon, 22 Nov 2021 15:43:20 +0000
treeherdermozilla-central@d8a16efe2d2c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs, fluent-reviewers, nbaumgardner, kpatenio
bugs1733495
milestone96.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 1733495 - Migrate plugins.properties to aboutPlugins.ftl. r=Gijs,fluent-reviewers,nbaumgardner,kpatenio This is the first patch made using the properties-to-ftl tooling: https://github.com/mozilla/properties-to-ftl Differential Revision: https://phabricator.services.mozilla.com/D130984
dom/locales/en-US/chrome/plugins.properties
dom/locales/jar.mn
dom/locales/moz.build
mobile/android/locales/filter.py
mobile/android/locales/jar.mn
mobile/android/locales/l10n.toml
mobile/locales/filter.py
python/l10n/fluent_migrations/bug_1733495_gmpPlugins.py
toolkit/locales/en-US/toolkit/about/aboutPlugins.ftl
toolkit/mozapps/extensions/internal/GMPProvider.jsm
toolkit/mozapps/extensions/test/xpcshell/test_gmpProvider.js
deleted file mode 100644
--- a/dom/locales/en-US/chrome/plugins.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/.
-
-# GMP Plugins
-gmp_license_info=License information
-gmp_privacy_info=Privacy Information
-
-openH264_name=OpenH264 Video Codec provided by Cisco Systems, Inc.
-openH264_description2=This plugin is automatically installed by Mozilla to comply with the WebRTC specification and to enable WebRTC calls with devices that require the H.264 video codec. Visit https://www.openh264.org/ to view the codec source code and learn more about the implementation.
-
-cdm_description2=This plugin enables playback of encrypted media in compliance with the Encrypted Media Extensions specification. Encrypted media is typically used by sites to protect against copying of premium media content. Visit https://www.w3.org/TR/encrypted-media/ for more information on Encrypted Media Extensions.
-
-widevine_description=Widevine Content Decryption Module provided by Google Inc.
--- a/dom/locales/jar.mn
+++ b/dom/locales/jar.mn
@@ -11,17 +11,16 @@
   locale/@AB_CD@/global/xul.properties                         (%chrome/layout/xul.properties)
   locale/@AB_CD@/global/printing.properties                    (%chrome/layout/printing.properties)
   locale/@AB_CD@/global/layout_errors.properties               (%chrome/layout/layout_errors.properties)
   locale/@AB_CD@/global/netError.dtd                           (%chrome/netError.dtd)
   locale/@AB_CD@/global/netErrorApp.dtd                        (%chrome/netErrorApp.dtd)
   locale/@AB_CD@/global/global.dtd                             (%chrome/global.dtd)
   locale/@AB_CD@/global/appstrings.properties                  (%chrome/appstrings.properties)
   locale/@AB_CD@/global/global-strres.properties               (%chrome/global-strres.properties)
-  locale/@AB_CD@/global/plugins.properties                     (%chrome/plugins.properties)
   locale/@AB_CD@/global/nsWebBrowserPersist.properties         (%chrome/nsWebBrowserPersist.properties)
   locale/@AB_CD@/global/xslt/xslt.properties                   (%chrome/xslt/xslt.properties)
   locale/@AB_CD@/global/dom/dom.properties                     (%chrome/dom/dom.properties)
   locale/@AB_CD@/global/svg/svg.properties                     (%chrome/svg/svg.properties)
   locale/@AB_CD@/global/layout/MediaDocument.properties        (%chrome/layout/MediaDocument.properties)
   locale/@AB_CD@/global/layout/htmlparser.properties           (%chrome/layout/htmlparser.properties)
   locale/@AB_CD@/global/layout/xmlparser.properties            (%chrome/layout/xmlparser.properties)
   locale/@AB_CD@/global/layout/HtmlForm.properties             (%chrome/layout/HtmlForm.properties)
--- a/dom/locales/moz.build
+++ b/dom/locales/moz.build
@@ -47,19 +47,16 @@ with Files("en-US/chrome/svg/**"):
     BUG_COMPONENT = ("Core", "SVG")
 
 with Files("en-US/chrome/xml/**"):
     BUG_COMPONENT = ("Core", "XML")
 
 with Files("en-US/chrome/xslt/**"):
     BUG_COMPONENT = ("Core", "XSLT")
 
-with Files("en-US/chrome/plugins.properties"):
-    BUG_COMPONENT = ("Core", "Plug-ins")
-
 JAR_MANIFESTS += ["jar.mn"]
 
 RESOURCE_FILES.locale.layout += [
     "en-US/chrome/layout/HtmlForm.properties",
     "en-US/chrome/layout/MediaDocument.properties",
     "en-US/chrome/layout/xmlparser.properties",
 ]
 
--- a/mobile/android/locales/filter.py
+++ b/mobile/android/locales/filter.py
@@ -53,17 +53,16 @@ def test(mod, path, entity=None):
         return "ignore"
 
     if mod == "dom":
         # keep this file list in sync with jar.mn
         if path in (
             "chrome/global.dtd",
             "chrome/accessibility/AccessFu.properties",
             "chrome/dom/dom.properties",
-            "chrome/plugins.properties",
         ):
             return "error"
         return "ignore"
 
     if mod not in ("mobile", "mobile/android"):
         # we only have exceptions for mobile*
         return "error"
     if mod == "mobile/android":
--- a/mobile/android/locales/jar.mn
+++ b/mobile/android/locales/jar.mn
@@ -23,18 +23,16 @@ relativesrcdir toolkit/locales:
   locale/@AB_CD@/browser/overrides/intl.css                        (%chrome/global/intl.css)
 
 # overrides for dom l10n, also for en-US
 # keep this file list in sync with filter.py
 relativesrcdir dom/locales:
   locale/@AB_CD@/browser/overrides/global.dtd                  (%chrome/global.dtd)
   locale/@AB_CD@/browser/overrides/AccessFu.properties         (%chrome/accessibility/AccessFu.properties)
   locale/@AB_CD@/browser/overrides/dom/dom.properties          (%chrome/dom/dom.properties)
-#about:plugins
-  locale/@AB_CD@/browser/overrides/plugins.properties          (%chrome/plugins.properties)
 
 # Fluent files
 # Note: All rules must be wildcards, as localized files are optional
 # Only run this if we're not en-US, as en-US is already built
 # by toolkit/locales/jar.mn.
 # If you're including files from a subdirectory, ensure that you're
 # putting them into the corresponding subdirectory in the target.
 # The wildcard ** does that for us in toolkit.
--- a/mobile/android/locales/l10n.toml
+++ b/mobile/android/locales/l10n.toml
@@ -141,20 +141,16 @@ exclude-multi-locale = [
     reference = "dom/locales/en-US/chrome/dom/dom.properties"
     l10n = "{l}dom/chrome/dom/dom.properties"
 
 [[paths]]
     reference = "toolkit/locales/en-US/toolkit/about/*Plugins.ftl"
     l10n = "{l}toolkit/toolkit/about/*Plugins.ftl"
 
 [[paths]]
-    reference = "dom/locales/en-US/chrome/plugins.properties"
-    l10n = "{l}dom/chrome/plugins.properties"
-
-[[paths]]
     reference = "toolkit/locales/en-US/toolkit/about/*About.ftl"
     l10n = "{l}toolkit/toolkit/about/*About.ftl"
 
 [[paths]]
     reference = "toolkit/locales/en-US/toolkit/about/*Mozilla.ftl"
     l10n = "{l}toolkit/toolkit/about/*Mozilla.ftl"
 
 [[paths]]
--- a/mobile/locales/filter.py
+++ b/mobile/locales/filter.py
@@ -54,17 +54,16 @@ def test(mod, path, entity=None):
         return "ignore"
 
     if mod == "dom":
         # keep this file list in sync with jar.mn
         if path in (
             "chrome/global.dtd",
             "chrome/accessibility/AccessFu.properties",
             "chrome/dom/dom.properties",
-            "chrome/plugins.properties",
         ):
             return "error"
         return "ignore"
 
     if mod not in ("mobile", "mobile/android"):
         # we only have exceptions for mobile*
         return "error"
     if mod == "mobile/android":
new file mode 100644
--- /dev/null
+++ b/python/l10n/fluent_migrations/bug_1733495_gmpPlugins.py
@@ -0,0 +1,42 @@
+# Any copyright is dedicated to the Public Domain.
+# http://creativecommons.org/publicdomain/zero/1.0/
+
+import fluent.syntax.ast as FTL
+from fluent.migrate.transforms import COPY
+
+
+def migrate(ctx):
+    """Bug 1733495 - Convert plugins.properties to Fluent, part {index}."""
+
+    source = "dom/chrome/plugins.properties"
+    target = "toolkit/toolkit/about/aboutPlugins.ftl"
+    ctx.add_transforms(
+        target,
+        target,
+        [
+            FTL.Message(
+                id=FTL.Identifier("plugins-gmp-license-info"),
+                value=COPY(source, "gmp_license_info"),
+            ),
+            FTL.Message(
+                id=FTL.Identifier("plugins-gmp-privacy-info"),
+                value=COPY(source, "gmp_privacy_info"),
+            ),
+            FTL.Message(
+                id=FTL.Identifier("plugins-openh264-name"),
+                value=COPY(source, "openH264_name"),
+            ),
+            FTL.Message(
+                id=FTL.Identifier("plugins-openh264-description"),
+                value=COPY(source, "openH264_description2"),
+            ),
+            FTL.Message(
+                id=FTL.Identifier("plugins-widevine-name"),
+                value=COPY(source, "widevine_description"),
+            ),
+            FTL.Message(
+                id=FTL.Identifier("plugins-widevine-description"),
+                value=COPY(source, "cdm_description2"),
+            ),
+        ],
+    )
--- a/toolkit/locales/en-US/toolkit/about/aboutPlugins.ftl
+++ b/toolkit/locales/en-US/toolkit/about/aboutPlugins.ftl
@@ -28,8 +28,19 @@ version-dd = <span data-l10n-name="versi
 state-dd-enabled = <span data-l10n-name="state">State:</span> Enabled
 state-dd-enabled-block-list-state = <span data-l10n-name="state">State:</span> Enabled ({ $blockListState })
 state-dd-Disabled = <span data-l10n-name="state">State:</span> Disabled
 state-dd-Disabled-block-list-state = <span data-l10n-name="state">State:</span> Disabled ({ $blockListState })
 
 mime-type-label = MIME Type
 description-label = Description
 suffixes-label = Suffixes
+
+## Gecko Media Plugins (GMPs)
+
+plugins-gmp-license-info = License information
+plugins-gmp-privacy-info = Privacy Information
+
+plugins-openh264-name = OpenH264 Video Codec provided by Cisco Systems, Inc.
+plugins-openh264-description = This plugin is automatically installed by Mozilla to comply with the WebRTC specification and to enable WebRTC calls with devices that require the H.264 video codec. Visit https://www.openh264.org/ to view the codec source code and learn more about the implementation.
+
+plugins-widevine-name = Widevine Content Decryption Module provided by Google Inc.
+plugins-widevine-description = This plugin enables playback of encrypted media in compliance with the Encrypted Media Extensions specification. Encrypted media is typically used by sites to protect against copying of premium media content. Visit https://www.w3.org/TR/encrypted-media/ for more information on Encrypted Media Extensions.
--- a/toolkit/mozapps/extensions/internal/GMPProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/GMPProvider.jsm
@@ -36,45 +36,46 @@ const GMP_CHECK_DELAY = 10 * 1000; // mi
 const XHTML = "http://www.w3.org/1999/xhtml";
 
 const NS_GRE_DIR = "GreD";
 const CLEARKEY_PLUGIN_ID = "gmp-clearkey";
 const CLEARKEY_VERSION = "0.1";
 
 const FIRST_CONTENT_PROCESS_TOPIC = "ipc:first-content-process-created";
 
-const GMP_LICENSE_INFO = "gmp_license_info";
-const GMP_PRIVACY_INFO = "gmp_privacy_info";
+const GMP_LICENSE_INFO = "plugins-gmp-license-info";
+const GMP_PRIVACY_INFO = "plugins-gmp-privacy-info";
 const GMP_LEARN_MORE = "learn_more_label";
 
 const GMP_PLUGINS = [
   {
     id: OPEN_H264_ID,
-    name: "openH264_name",
-    description: "openH264_description2",
+    name: "plugins-openh264-name",
+    description: "plugins-openh264-description",
     // The following licenseURL is part of an awful hack to include the OpenH264
     // license without having bug 624602 fixed yet, and intentionally ignores
     // localisation.
     licenseURL: "chrome://mozapps/content/extensions/OpenH264-license.txt",
     homepageURL: "https://www.openh264.org/",
   },
   {
     id: WIDEVINE_ID,
-    name: "widevine_description",
-    // Describe the purpose of both CDMs in the same way.
-    description: "cdm_description2",
+    name: "plugins-widevine-name",
+    description: "plugins-widevine-description",
     licenseURL: "https://www.google.com/policies/privacy/",
     homepageURL: "https://www.widevine.com/",
     isEME: true,
   },
 ];
 XPCOMUtils.defineConstant(this, "GMP_PLUGINS", GMP_PLUGINS);
 
-XPCOMUtils.defineLazyGetter(this, "pluginsBundle", () =>
-  Services.strings.createBundle("chrome://global/locale/plugins.properties")
+XPCOMUtils.defineLazyGetter(
+  this,
+  "pluginsBundle",
+  () => new Localization(["toolkit/about/aboutPlugins.ftl"], true)
 );
 XPCOMUtils.defineLazyGetter(this, "gmpService", () =>
   Cc["@mozilla.org/gecko-media-plugin-service;1"].getService(
     Ci.mozIGeckoMediaPluginChromeService
   )
 );
 
 var gLogger;
@@ -187,17 +188,17 @@ GMPWrapper.prototype = {
         "licenseURL",
         this.id == WIDEVINE_ID ? GMP_PRIVACY_INFO : GMP_LICENSE_INFO,
       ],
     ]) {
       if (plugin[urlProp]) {
         let a = doc.createElementNS(XHTML, "a");
         a.href = plugin[urlProp];
         a.target = "_blank";
-        a.textContent = pluginsBundle.GetStringFromName(labelId);
+        a.textContent = pluginsBundle.formatValueSync(labelId);
 
         if (frag.childElementCount) {
           frag.append(
             doc.createElementNS(XHTML, "br"),
             doc.createElementNS(XHTML, "br")
           );
         }
         frag.append(a);
@@ -828,18 +829,18 @@ var GMPProvider = {
     return GMPPrefs.getBool(GMPPrefs.KEY_PROVIDER_ENABLED, false);
   },
 
   buildPluginList() {
     this._plugins = new Map();
     for (let aPlugin of GMP_PLUGINS) {
       let plugin = {
         id: aPlugin.id,
-        name: pluginsBundle.GetStringFromName(aPlugin.name),
-        description: pluginsBundle.GetStringFromName(aPlugin.description),
+        name: pluginsBundle.formatValueSync(aPlugin.name),
+        description: pluginsBundle.formatValueSync(aPlugin.description),
         homepageURL: aPlugin.homepageURL,
         optionsURL: aPlugin.optionsURL,
         wrapper: null,
         isEME: aPlugin.isEME,
       };
       plugin.wrapper = new GMPWrapper(plugin, aPlugin);
       this._plugins.set(plugin.id, plugin);
     }
--- a/toolkit/mozapps/extensions/test/xpcshell/test_gmpProvider.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_gmpProvider.js
@@ -6,18 +6,20 @@
 var GMPScope = ChromeUtils.import(
   "resource://gre/modules/addons/GMPProvider.jsm",
   null
 );
 const { UpdateUtils } = ChromeUtils.import(
   "resource://gre/modules/UpdateUtils.jsm"
 );
 
-XPCOMUtils.defineLazyGetter(this, "pluginsBundle", () =>
-  Services.strings.createBundle("chrome://global/locale/plugins.properties")
+XPCOMUtils.defineLazyGetter(
+  this,
+  "pluginsBundle",
+  () => new Localization(["toolkit/about/aboutPlugins.ftl"])
 );
 
 var gMockAddons = new Map();
 var gMockEmeAddons = new Map();
 
 for (let plugin of GMPScope.GMP_PLUGINS) {
   let mockAddon = Object.freeze({
     id: plugin.id,
@@ -103,19 +105,19 @@ add_task(async function test_notInstalle
   for (let addon of addons) {
     Assert.ok(!addon.isInstalled);
     Assert.equal(addon.type, "plugin");
     Assert.equal(addon.version, "");
 
     let mockAddon = gMockAddons.get(addon.id);
 
     Assert.notEqual(mockAddon, null);
-    let name = pluginsBundle.GetStringFromName(mockAddon.nameId);
+    let name = await pluginsBundle.formatValue(mockAddon.nameId);
     Assert.equal(addon.name, name);
-    let description = pluginsBundle.GetStringFromName(mockAddon.descriptionId);
+    let description = await pluginsBundle.formatValue(mockAddon.descriptionId);
     Assert.equal(addon.description, description);
 
     Assert.ok(!addon.isActive);
     Assert.ok(!addon.appDisabled);
     Assert.ok(addon.userDisabled);
 
     Assert.equal(
       addon.blocklistState,
@@ -173,17 +175,17 @@ add_task(async function test_installed()
     );
 
     Assert.ok(addon.isInstalled);
     Assert.equal(addon.type, "plugin");
     Assert.ok(!addon.isActive);
     Assert.ok(!addon.appDisabled);
     Assert.ok(addon.userDisabled);
 
-    let name = pluginsBundle.GetStringFromName(mockAddon.nameId);
+    let name = await pluginsBundle.formatValue(mockAddon.nameId);
     Assert.equal(addon.name, name);
     Assert.equal(addon.version, TEST_VERSION);
 
     Assert.equal(
       addon.permissions,
       AddonManager.PERM_CAN_UPGRADE | AddonManager.PERM_CAN_ENABLE
     );