Bug 1518220 - Replace the usage of formatValues with Fluent arguments, r=jaws,flod
authorYuan Cheng <chengy12@msu.edu>
Fri, 18 Jan 2019 18:03:18 +0000
changeset 514454 2a3cb2c2431d84093ba8caae7444dd681c3a2c66
parent 514453 6927759957ba288fffa5c32011b758cc7aeea5a4
child 514455 6c39cc812c87cf6ac71f6af96b60b3754a636eee
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjaws, flod
bugs1518220
milestone66.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 1518220 - Replace the usage of formatValues with Fluent arguments, r=jaws,flod Differential Revision: https://phabricator.services.mozilla.com/D16772
browser/base/content/aboutDialog.js
browser/locales/en-US/browser/aboutDialog.ftl
--- a/browser/base/content/aboutDialog.js
+++ b/browser/base/content/aboutDialog.js
@@ -31,36 +31,42 @@ async function init(aEvent) {
     if (distroAbout) {
       var distroField = document.getElementById("distribution");
       distroField.value = distroAbout;
       distroField.style.display = "block";
     }
   }
 
   // Include the build ID and display warning if this is an "a#" (nightly or aurora) build
-  let versionField = document.getElementById("version");
-  versionField.textContent = AppConstants.MOZ_APP_VERSION_DISPLAY;
+  let versionId = "aboutDialog-version";
+  let versionAttributes = {
+    version: AppConstants.MOZ_APP_VERSION_DISPLAY,
+    bits: Services.appinfo.is64Bit ? 64 : 32,
+  };
+
   let version = Services.appinfo.version;
   if (/a\d+$/.test(version)) {
+    versionId = "aboutDialog-version-nightly";
     let buildID = Services.appinfo.appBuildID;
     let year = buildID.slice(0, 4);
     let month = buildID.slice(4, 6);
     let day = buildID.slice(6, 8);
-    versionField.textContent += ` (${year}-${month}-${day})`;
+    versionAttributes.isodate = `${year}-${month}-${day}`;
 
     document.getElementById("experimental").hidden = false;
     document.getElementById("communityDesc").hidden = true;
   }
 
-  // Append "(32-bit)" or "(64-bit)" build architecture to the version number:
-  let archResource = Services.appinfo.is64Bit
-                     ? "aboutDialog-architecture-sixtyFourBit"
-                     : "aboutDialog-architecture-thirtyTwoBit";
-  let [arch] = await document.l10n.formatValues([{id: archResource}]);
-  versionField.textContent += ` (${arch})`;
+  // Use Fluent arguments for append version and the architecture of the build
+  let versionField = document.getElementById("version");
+
+  document.l10n.setAttributes(versionField, versionId, versionAttributes);
+
+  await document.l10n.translateElements([versionField]);
+  window.sizeToContent();
 
   // Show a release notes link if we have a URL.
   let relNotesLink = document.getElementById("releasenotes");
   let relNotesPrefType = Services.prefs.getPrefType("app.releaseNotesURL");
   if (relNotesPrefType != Services.prefs.PREF_INVALID) {
     let relNotesURL = Services.urlFormatter.formatURLPref("app.releaseNotesURL");
     if (relNotesURL != "about:blank") {
       relNotesLink.href = relNotesURL;
--- a/browser/locales/en-US/browser/aboutDialog.ftl
+++ b/browser/locales/en-US/browser/aboutDialog.ftl
@@ -42,10 +42,20 @@ community-exp = <label data-l10n-name="c
 community-2 = { -brand-short-name } is designed by <label data-l10n-name="community-mozillaLink">{ -vendor-short-name }</label>, a <label data-l10n-name="community-creditsLink">global community</label> working together to keep the Web open, public and accessible to all.
 
 helpus = Want to help? <label data-l10n-name="helpus-donateLink">Make a donation</label> or <label data-l10n-name="helpus-getInvolvedLink">get involved!</label>
 
 bottomLinks-license = Licensing Information
 bottomLinks-rights = End-User Rights
 bottomLinks-privacy = Privacy Policy
 
-aboutDialog-architecture-sixtyFourBit = 64-bit
-aboutDialog-architecture-thirtyTwoBit = 32-bit
+# Example of resulting string: 66.0.1 (64-bit)
+# Variables:
+#   $version (String): version of Firefox, e.g. 66.0.1
+#   $bits (Number): bits of the architecture (32 or 64)
+aboutDialog-version = { $version } ({ $bits }-bit)
+
+# Example of resulting string: 66.0a1 (2019-01-16) (64-bit)
+# Variables:
+#   $version (String): version of Firefox for Nightly builds, e.g. 66.0a1
+#   $isodate (String): date in ISO format, e.g. 2019-01-16
+#   $bits (Number): bits of the architecture (32 or 64)
+aboutDialog-version-nightly = { $version } ({ $isodate }) ({ $bits }-bit)