Bug 1414975 - Add locale information to about:support. r=osmose
MozReview-Commit-ID: Dwy3pEPJgeN
--- 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 & 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
@@ -646,17 +646,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.