Bug 1557766 - Adds Fluent support. r=fluent-reviewers,flod
authordleblanccyr <danielleleb12@gmail.com>
Wed, 10 Jul 2019 14:42:04 +0000
changeset 482260 b43e75b56fb86528f25ed074071bea5d877c2484
parent 482259 cf81db9c88874fd53345b64885bcf6a25b39810c
child 482261 7c43dc769da78fe45d9caf3d5dbd0205f33aa156
push id89659
push usercsabou@mozilla.com
push dateWed, 10 Jul 2019 19:45:26 +0000
treeherderautoland@b43e75b56fb8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfluent-reviewers, flod
bugs1557766
milestone70.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 1557766 - Adds Fluent support. r=fluent-reviewers,flod Differential Revision: https://phabricator.services.mozilla.com/D36184
browser/locales/jar.mn
toolkit/components/certviewer/content/certviewer.ftl
toolkit/components/certviewer/content/certviewer.html
toolkit/components/certviewer/content/components/certificate-section.js
toolkit/components/certviewer/content/components/info-item.js
--- a/browser/locales/jar.mn
+++ b/browser/locales/jar.mn
@@ -4,16 +4,17 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 # Note: This file should only contain locale entries. All
 # override and resource entries should go to browser/base/jar.mn to avoid
 # having to create the same entry for each locale.
 
 [localization] @AB_CD@.jar:
   browser/aboutLogins.ftl                          (../components/aboutlogins/content/aboutLogins.ftl)
+  toolkit/certviewer.ftl                           (../../toolkit/components/certviewer/content/certviewer.ftl)
   browser                                          (%browser/**/*.ftl)
 
 @AB_CD@.jar:
 % locale browser @AB_CD@ %locale/browser/
 # bookmarks.html is produced by LOCALIZED_GENERATED_FILES.
     locale/browser/bookmarks.html                  (bookmarks.html)
 
     locale/browser/accounts.properties             (%chrome/browser/accounts.properties)
new file mode 100644
--- /dev/null
+++ b/toolkit/components/certviewer/content/certviewer.ftl
@@ -0,0 +1,9 @@
+# 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/.
+
+### This file is not in a locales directory to prevent it from
+### being translated as the feature is still in heavy development
+### and strings are likely to change often.
+
+certificate-viewer-certificate-section-title = Certificate
--- a/toolkit/components/certviewer/content/certviewer.html
+++ b/toolkit/components/certviewer/content/certviewer.html
@@ -3,16 +3,18 @@
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <!DOCTYPE html>
 
 <html>
   <head>
     <meta name="viewport" content="width=device-width" />
     <meta http-equiv="Content-Security-Policy" content="default-src chrome:" />
+    <link rel="localization" href="toolkit/certviewer.ftl">
+    <link rel="localization" href="branding/brand.ftl">
     <script defer="defer" src="chrome://global/content/certviewer/certviewer.js"></script>
     <script defer="defer" src="chrome://global/content/certviewer/components/info-item.js"></script>
     <script defer="defer" src="chrome://global/content/certviewer/components/info-group.js"></script>
     <script defer="defer" src="chrome://global/content/certviewer/components/dummy-info.js"></script>
     <script defer="defer" src="chrome://global/content/certviewer/components/certificate-section.js"></script>
     <link rel="stylesheet" href="chrome://global/skin/in-content/common.css">
     <link rel="stylesheet" href="chrome://global/content/certviewer/certviewer.css">
     <title>about:certificate</title>
--- a/toolkit/components/certviewer/content/components/certificate-section.js
+++ b/toolkit/components/certviewer/content/components/certificate-section.js
@@ -10,25 +10,30 @@ class CertificateSection extends HTMLEle
   }
 
   connectedCallback() {
     let template = document.getElementById("certificate-section-template");
     let templateHtml = template.content.cloneNode(true);
 
     this.attachShadow({ mode: "open" }).appendChild(templateHtml);
 
+    document.l10n.connectRoot(this.shadowRoot);
+
     this.infoGroupsContainers = [];
     this.createInfoGroupsContainers();
+
     this.render();
   }
 
   render() {
     let certificateTabs = this.shadowRoot.querySelector(".certificate-tabs");
+
     let title = this.shadowRoot.querySelector(".title");
-    title.textContent = "Certificate";
+    title.setAttribute("data-l10n-id", "certificate-section-title");
+
     this.infoGroupContainer = this.shadowRoot.querySelector(".info-groups");
     for (let i = 0; i < certArray.length; i++) {
       let tab = document.createElement("button");
       tab.textContent = "tab" + i;
       tab.setAttribute("id", "tab" + i);
       tab.setAttribute("aria-controls", "panel" + i);
       tab.setAttribute("idnumber", i);
       tab.setAttribute("role", "tab");
--- a/toolkit/components/certviewer/content/components/info-item.js
+++ b/toolkit/components/certviewer/content/components/info-item.js
@@ -9,24 +9,29 @@ class InfoItem extends HTMLElement {
   }
 
   connectedCallback() {
     let infoItemTemplate = document.getElementById("info-item-template");
 
     this.attachShadow({ mode: "open" }).appendChild(
       infoItemTemplate.content.cloneNode(true)
     );
+
+    document.l10n.translateFragment(this.shadowRoot);
+    document.l10n.connectRoot(this.shadowRoot);
+
     this.render();
   }
 
   render() {
     let label = this.shadowRoot.querySelector("label");
-    let info = this.shadowRoot.querySelector(".info");
+    let labelText = this.item.label.replace(/\s+/g, "-").toLowerCase();
+    label.setAttribute("data-l10n-id", labelText);
 
-    label.textContent = this.item.label;
+    let info = this.shadowRoot.querySelector(".info");
     info.textContent = this.item.info;
 
     // TODO: Use Fluent-friendly condition.
     if (this.item.label === "Modulus") {
       info.classList.add("long-hex");
     }
   }
 }