diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index f302208534859..cb8a20a4cbae6 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -710,9 +710,6 @@ pref("browser.download.clearHistoryOnDelete", 0); pref("browser.helperApps.showOpenOptionForPdfJS", true); pref("browser.helperApps.showOpenOptionForViewableInternally", true); -// search engine removal URL -pref("browser.search.searchEngineRemoval", "https://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/search-engine-removal"); - // search engines URL pref("browser.search.searchEnginesURL", "https://addons.mozilla.org/%LOCALE%/firefox/search-engines/"); diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index a0b76fbe0402f..ad99735fab609 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -4290,26 +4290,8 @@ const BrowserSearch = { * @param {string} newEngine * name of the application default engine to replaced the removed engine. */ - removalOfSearchEngineNotificationBox(oldEngine, newEngine) { - let messageFragment = document.createDocumentFragment(); - let message = document.createElement("span"); - let link = document.createXULElement("label", { - is: "text-link", - }); - - link.href = Services.urlFormatter.formatURLPref( - "browser.search.searchEngineRemoval" - ); - link.setAttribute("data-l10n-name", "remove-search-engine-article"); - document.l10n.setAttributes(message, "removed-search-engine-message", { - oldEngine, - newEngine, - }); - - message.appendChild(link); - messageFragment.appendChild(message); - - let button = [ + async removalOfSearchEngineNotificationBox(oldEngine, newEngine) { + let buttons = [ { "l10n-id": "remove-search-engine-button", primary: true, @@ -4320,15 +4302,21 @@ const BrowserSearch = { gNotificationBox.removeNotification(notificationBox); }, }, + { + supportPage: "search-engine-removal", + }, ]; - gNotificationBox.appendNotification( + await gNotificationBox.appendNotification( "search-engine-removal", { - label: messageFragment, + label: { + "l10n-id": "removed-search-engine-message2", + "l10n-args": { oldEngine, newEngine }, + }, priority: gNotificationBox.PRIORITY_SYSTEM, }, - button + buttons ); // Update engine name in the placeholder to the new default engine name. diff --git a/browser/components/urlbar/tests/browser/browser_placeholder.js b/browser/components/urlbar/tests/browser/browser_placeholder.js index fbf0a5007c62a..e096c6fdf648d 100644 --- a/browser/components/urlbar/tests/browser/browser_placeholder.js +++ b/browser/components/urlbar/tests/browser/browser_placeholder.js @@ -360,7 +360,7 @@ add_task(async function test_change_default_engine_updates_placeholder() { ); info("Show search engine removal info bar"); - BrowserSearch.removalOfSearchEngineNotificationBox( + await BrowserSearch.removalOfSearchEngineNotificationBox( extraEngine.name, originalEngine.name ); diff --git a/browser/locales/en-US/browser/search.ftl b/browser/locales/en-US/browser/search.ftl index 327afa3443968..c6f3e8cde3315 100644 --- a/browser/locales/en-US/browser/search.ftl +++ b/browser/locales/en-US/browser/search.ftl @@ -34,5 +34,5 @@ searchbar-icon = ## $oldEngine (String) - the search engine to be removed. ## $newEngine (String) - the search engine to replace the removed search engine. -removed-search-engine-message = Your default search engine has been changed. { $oldEngine } is no longer available as a default search engine in { -brand-short-name }. { $newEngine } is now your default search engine. To change to another default search engine, go to settings. +removed-search-engine-message2 = Your default search engine has been changed. { $oldEngine } is no longer available as a default search engine in { -brand-short-name }. { $newEngine } is now your default search engine. To change to another default search engine, go to settings. remove-search-engine-button = OK diff --git a/python/l10n/fluent_migrations/bug_1845150_search_engine_notification.py b/python/l10n/fluent_migrations/bug_1845150_search_engine_notification.py new file mode 100644 index 0000000000000..125baa4c1fbe6 --- /dev/null +++ b/python/l10n/fluent_migrations/bug_1845150_search_engine_notification.py @@ -0,0 +1,32 @@ +# Any copyright is dedicated to the Public Domain. +# http://creativecommons.org/publicdomain/zero/1.0/ + +import re +import fluent.syntax.ast as FTL +from fluent.migrate.transforms import TransformPattern + + +class STRIP_LABEL(TransformPattern): + # Used to remove `