Bug 1414975 - Add locale information to about:support. r=mkelly
authorZibi Braniecki <zbraniecki@mozilla.com>
Mon, 06 Nov 2017 15:42:32 -0800
changeset 390786 a82270f0b8a9fcc07cbb24dcb561bea40f77a83f
parent 390785 7279b117245bfa6fb87f4b404f5c187838a603c7
child 390787 27ca9370036f9f0a39203073201e13918064cf75
child 390843 6d99b1e6c77737f2d6b1f1a95580c9937fcf4793
push id55015
push userzbraniecki@mozilla.com
push dateWed, 08 Nov 2017 18:17:57 +0000
treeherderautoland@a82270f0b8a9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmkelly
bugs1414975
milestone58.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 1414975 - Add locale information to about:support. r=mkelly MozReview-Commit-ID: Dwy3pEPJgeN
toolkit/content/aboutSupport.js
toolkit/content/aboutSupport.xhtml
toolkit/locales/en-US/chrome/global/aboutSupport.dtd
toolkit/modules/Troubleshoot.jsm
toolkit/modules/tests/browser/browser_Troubleshoot.js
--- a/toolkit/content/aboutSupport.js
+++ b/toolkit/content/aboutSupport.js
@@ -802,16 +802,34 @@ var snapshotFormatters = {
         ];
         for (let arg of syscall.args) {
           cells.push($.new("td", arg, "integer"));
         }
         syscallBody.appendChild($.new("tr", cells));
       }
     }
   },
+
+  intl: function intl(data) {
+    $("intl-locale-requested").textContent =
+      JSON.stringify(data.localeService.requested);
+    $("intl-locale-available").textContent =
+      JSON.stringify(data.localeService.available);
+    $("intl-locale-supported").textContent =
+      JSON.stringify(data.localeService.supported);
+    $("intl-locale-regionalprefs").textContent =
+      JSON.stringify(data.localeService.regionalPrefs);
+    $("intl-locale-default").textContent =
+      JSON.stringify(data.localeService.defaultLocale);
+
+    $("intl-osprefs-systemlocales").textContent =
+      JSON.stringify(data.osPrefs.systemLocales);
+    $("intl-osprefs-regionalprefs").textContent =
+      JSON.stringify(data.osPrefs.regionalPrefsLocales);
+  }
 };
 
 var $ = document.getElementById.bind(document);
 
 $.new = function $_new(tag, textContentOrChildren, className, attributes) {
   let elt = document.createElement(tag);
   if (className)
     elt.className = className;
--- a/toolkit/content/aboutSupport.xhtml
+++ b/toolkit/content/aboutSupport.xhtml
@@ -746,13 +746,84 @@
 	    </tr>
 	</thead>
 	<tbody id="sandbox-syscalls-tbody">
 	</tbody>
       </table>
 #endif
 #endif
 
+      <h2 class="major-section">
+        &aboutSupport.intlTitle;
+      </h2>
+
+      <table>
+        <tbody id="intl-localeservice-tbody">
+          <tr>
+            <th colspan="2" class="title-column">
+              &aboutSupport.intlAppTitle;
+            </th>
+          </tr>
+          <tr>
+            <th class="column">
+              &aboutSupport.intlLocalesRequested;
+            </th>
+            <td id="intl-locale-requested">
+            </td>
+          </tr>
+          <tr>
+            <th class="column">
+              &aboutSupport.intlLocalesAvailable;
+            </th>
+            <td id="intl-locale-available">
+            </td>
+          </tr>
+          <tr>
+            <th class="column">
+              &aboutSupport.intlLocalesSupported;
+            </th>
+            <td id="intl-locale-supported">
+            </td>
+          </tr>
+          <tr>
+            <th class="column">
+              &aboutSupport.intlRegionalPrefs;
+            </th>
+            <td id="intl-locale-regionalprefs">
+            </td>
+          </tr>
+          <tr>
+            <th class="column">
+              &aboutSupport.intlLocalesDefault;
+            </th>
+            <td id="intl-locale-default">
+            </td>
+          </tr>
+        </tbody>
+        <tbody id="intl-ospreferences-tbody">
+          <tr>
+            <th colspan="2" class="title-column">
+              &aboutSupport.intlOSTitle;
+            </th>
+          </tr>
+          <tr>
+            <th class="column">
+              &aboutSupport.intlOSPrefsSystemLocales;
+            </th>
+            <td id="intl-osprefs-systemlocales">
+            </td>
+          </tr>
+          <tr>
+            <th class="column">
+              &aboutSupport.intlRegionalPrefs;
+            </th>
+            <td id="intl-osprefs-regionalprefs">
+            </td>
+          </tr>
+        </tbody>
+      </table>
+      <!-- - - - - - - - - - - - - - - - - - - - - -->
+
     </div>
 
   </body>
 
 </html>
--- a/toolkit/locales/en-US/chrome/global/aboutSupport.dtd
+++ b/toolkit/locales/en-US/chrome/global/aboutSupport.dtd
@@ -150,8 +150,18 @@ variant of aboutSupport.showDir.label. -
 <!ENTITY aboutSupport.mediaDeviceGroup "Group">
 <!ENTITY aboutSupport.mediaDeviceVendor "Vendor">
 <!ENTITY aboutSupport.mediaDeviceState "State">
 <!ENTITY aboutSupport.mediaDevicePreferred "Preferred">
 <!ENTITY aboutSupport.mediaDeviceFormat "Format">
 <!ENTITY aboutSupport.mediaDeviceChannels "Channels">
 <!ENTITY aboutSupport.mediaDeviceRate "Rate">
 <!ENTITY aboutSupport.mediaDeviceLatency "Latency">
+
+<!ENTITY aboutSupport.intlTitle "Internationalization &amp; Localization">
+<!ENTITY aboutSupport.intlAppTitle "Application Settings">
+<!ENTITY aboutSupport.intlLocalesRequested "Requested Locales">
+<!ENTITY aboutSupport.intlLocalesAvailable "Available Locales">
+<!ENTITY aboutSupport.intlLocalesSupported "App Locales">
+<!ENTITY aboutSupport.intlLocalesDefault "Default Locale">
+<!ENTITY aboutSupport.intlOSTitle "Operating System">
+<!ENTITY aboutSupport.intlOSPrefsSystemLocales "System Locales">
+<!ENTITY aboutSupport.intlRegionalPrefs "Regional Preferences">
--- a/toolkit/modules/Troubleshoot.jsm
+++ b/toolkit/modules/Troubleshoot.jsm
@@ -645,17 +645,35 @@ var dataProviders = {
   },
 
   userJS: function userJS(done) {
     let userJSFile = Services.dirsvc.get("PrefD", Ci.nsIFile);
     userJSFile.append("user.js");
     done({
       exists: userJSFile.exists() && userJSFile.fileSize > 0,
     });
-  }
+  },
+
+  intl: function intl(done) {
+    const osPrefs =
+      Cc["@mozilla.org/intl/ospreferences;1"].getService(Ci.mozIOSPreferences);
+    done({
+      localeService: {
+        requested: Services.locale.getRequestedLocales(),
+        available: Services.locale.getAvailableLocales(),
+        supported: Services.locale.getAppLocalesAsBCP47(),
+        regionalPrefs: Services.locale.getRegionalPrefsLocales(),
+        defaultLocale: Services.locale.defaultLocale,
+      },
+      osPrefs: {
+        systemLocales: osPrefs.getSystemLocales(),
+        regionalPrefsLocales: osPrefs.getRegionalPrefsLocales()
+      },
+    });
+  },
 };
 
 if (AppConstants.MOZ_CRASHREPORTER) {
   dataProviders.crashes = function crashes(done) {
     let CrashReports = Cu.import("resource://gre/modules/CrashReports.jsm").CrashReports;
     let reports = CrashReports.getReports();
     let now = new Date();
     let reportsNew = reports.filter(report => (now - report.date < Troubleshoot.kMaxCrashAge));
--- a/toolkit/modules/tests/browser/browser_Troubleshoot.js
+++ b/toolkit/modules/tests/browser/browser_Troubleshoot.js
@@ -739,16 +739,62 @@ const SNAPSHOT_SCHEMA = {
                   type: "string",
                 },
               },
             },
           },
         },
       },
     },
+    intl: {
+      required: true,
+      type: "object",
+      properties: {
+        localeService: {
+          required: true,
+          type: "object",
+          properties: {
+            requested: {
+              required: true,
+              type: "array"
+            },
+            available: {
+              required: true,
+              type: "array"
+            },
+            supported: {
+              required: true,
+              type: "array"
+            },
+            regionalPrefs: {
+              required: true,
+              type: "array"
+            },
+            defaultLocale: {
+              required: true,
+              type: "string"
+            },
+          },
+        },
+        osPrefs: {
+          required: true,
+          type: "object",
+          properties: {
+            systemLocales: {
+              required: true,
+              type: "array"
+            },
+            regionalPrefsLocales: {
+              required: true,
+              type: "array"
+            },
+          },
+        },
+      },
+    },
   },
 };
 
 /**
  * Throws an Error if obj doesn't conform to schema.  That way you get a nice
  * error message and a stack to help you figure out what went wrong, which you
  * wouldn't get if this just returned true or false instead.  There's still
  * room for improvement in communicating validation failures, however.