Bug 1518076 - Use localised strings in WeTransfer settings page. r=philipp a=jorgk
authorGeoff Lankow <geoff@darktrojan.net>
Thu, 10 Jan 2019 10:17:26 +1300
changeset 33934 f4d16faced06f2872da2d66f8ef8f623432ef838
parent 33933 0f6e3ac081e93e96c507bbcb6fc637e1f0e6e242
child 33935 def81e026d016e67859ae43e7356508ba8090b5b
push id388
push userclokep@gmail.com
push dateMon, 28 Jan 2019 20:54:56 +0000
reviewersphilipp, jorgk
bugs1518076
Bug 1518076 - Use localised strings in WeTransfer settings page. r=philipp a=jorgk
mail/components/cloudfile/wetransfer/_locales/en/messages.json
mail/components/cloudfile/wetransfer/content/moments.html
mail/components/cloudfile/wetransfer/content/moments.js
--- a/mail/components/cloudfile/wetransfer/_locales/en/messages.json
+++ b/mail/components/cloudfile/wetransfer/_locales/en/messages.json
@@ -2,10 +2,16 @@
   "extensionDescription": {
     "message": "Share your attachments via WeTransfer"
   },
   "extensionName": {
     "message": "FileLink for WeTransfer"
   },
   "serviceName": {
     "message": "WeTransfer"
+  },
+  "moments_privacyPolicy": {
+    "message": "Privacy Policy"
+  },
+  "moments_tagline": {
+    "message": "WeTransfer is the simplest way to send your files around the world."
   }
 }
--- a/mail/components/cloudfile/wetransfer/content/moments.html
+++ b/mail/components/cloudfile/wetransfer/content/moments.html
@@ -1,20 +1,20 @@
 <!DOCTYPE html>
 <!-- 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/. -->
 
 <html>
   <head>
-    <script src="moments.js"></script>
+    <script src="moments.js" defer=""></script>
     <meta charset="UTF-8">
     <link rel="stylesheet" type="text/css" href="moments.css"/>
   </head>
   <body>
-    <h1>WeTransfer is the simplest way to send your files around the world.</h1>
-    <a class="text-link" href="https://wetransfer.com/legal/terms" target="_blank">Privacy Policy</a>
+    <h1 data-message="moments_tagline"></h1>
+    <a class="text-link" href="https://wetransfer.com/legal/terms" target="_blank" data-message="moments_privacyPolicy"></a>
     <a id="story" href="#" target="_blank">
       <img id="background"></img>
       <div id="title"></div>
     </a>
   </body>
 </html>
--- a/mail/components/cloudfile/wetransfer/content/moments.js
+++ b/mail/components/cloudfile/wetransfer/content/moments.js
@@ -1,13 +1,17 @@
 /* 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/. */
 
 (async () => {
+  for (let element of document.querySelectorAll("[data-message]")) {
+    element.textContent = browser.i18n.getMessage(element.dataset.message);
+  }
+
   let resp = await fetch("https://backgrounds.wetransfer.net/moment/list.json");
   let items = await resp.json();
   let item = items[Math.floor(Math.random() * items.length)];
   if (item.url.startsWith("https:") && item.file.startsWith("https:")) {
     document.getElementById("background").src = item.file;
     document.getElementById("story").href = item.url;
     document.getElementById("title").textContent = item.title;
   }