Bug 1911321 - Add new set_fallback method to intl.ui.browserLanguage telemetry action. r=settings-reviewers,mossop

Differential Revision: https://phabricator.services.mozilla.com/D218414
This commit is contained in:
Eemeli Aro
2024-08-14 12:53:43 +00:00
parent d0a8f8f6a6
commit ddf45ffed7
3 changed files with 38 additions and 0 deletions

View File

@@ -1877,6 +1877,18 @@ var gMainPane = {
return;
}
// Track how often locale fallback order is changed.
// Drop the first locale and filter to only include the overlapping set
const prevLocales = Services.locale.requestedLocales.filter(
lc => selected.indexOf(lc) > 0
);
const newLocales = selected.filter(
(lc, i) => i > 0 && prevLocales.includes(lc)
);
if (prevLocales.some((lc, i) => newLocales[i] != lc)) {
this.gBrowserLanguagesDialog.recordTelemetry("set_fallback");
}
switch (gMainPane.getLanguageSwitchTransitionType(selected)) {
case "requires-restart":
gMainPane.showConfirmLanguageChangeMessageBar(selected);

View File

@@ -441,6 +441,24 @@ add_task(async function testReorderingBrowserLanguages() {
"The second dialog id is larger than the first"
);
// Open the dialog yet again.
newDialog = await openDialog(doc);
dialog = newDialog.dialog;
dialogDoc = newDialog.dialogDoc;
let thirdDialogId = getDialogId(dialogDoc);
selected = newDialog.selected;
// Move pl to the top.
selectAddedLocale("pl", selected);
assertLocaleOrder(selected, "en-US,he,pl", "pl");
dialogDoc.getElementById("up").doCommand();
dialogDoc.getElementById("up").doCommand();
assertLocaleOrder(selected, "pl,en-US,he", "pl");
dialogClosed = BrowserTestUtils.waitForEvent(dialog, "dialogclosing");
dialog.acceptDialog();
await dialogClosed;
await Promise.all(addons.map(addon => addon.uninstall()));
BrowserTestUtils.removeTab(gBrowser.selectedTab);
@@ -448,9 +466,14 @@ add_task(async function testReorderingBrowserLanguages() {
["manage", "main", firstDialogId],
["reorder", "dialog", firstDialogId],
["accept", "dialog", firstDialogId],
["set_fallback", "dialog", firstDialogId],
["manage", "main", secondDialogId],
["reorder", "dialog", secondDialogId],
["accept", "dialog", secondDialogId],
["manage", "main", thirdDialogId],
["reorder", "dialog", thirdDialogId],
["reorder", "dialog", thirdDialogId],
["accept", "dialog", thirdDialogId],
]);
});

View File

@@ -2601,6 +2601,7 @@ intl.ui.browserLanguage:
- apply
- accept
- cancel
- set_fallback
extra_keys:
installId: The id for an install.
products:
@@ -2609,6 +2610,7 @@ intl.ui.browserLanguage:
notification_emails:
- flod@mozilla.com
- mstriemer@mozilla.com
- earo@mozilla.com
release_channel_collection: opt-out
record_in_processes: ["main"]
bug_numbers:
@@ -2619,6 +2621,7 @@ intl.ui.browserLanguage:
- 1739288
- 1796396
- 1861299
- 1911321
network.dns:
trrConfirmation: