diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 660b70f0235c..c62c5e0cd014 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -3600,7 +3600,6 @@ pref("browser.sanitizer.loglevel", "Warn"); // engine https://browser.mt/. See Bug 971044. Note that this pref can be turned // on in different apps like Firefox Desktop, even if it's disabled by default here. pref("browser.translations.enable", false); - // Set to "All" to see all logs, which are useful for debugging. Set to "Info" to see // the application logic logs, and not all of the translated messages, which can be // slow and overwhelming. @@ -3616,10 +3615,6 @@ pref("browser.translations.neverTranslateLanguages", ""); // and the full page translations uses HTML. Set this pref to true to use the HTML // translation behavior on about:translations. Requires a page refresh. pref("browser.translations.useHTML", false); -// Normally there is a UI to ask the user to translate a page, this pref makes it -// so that the page automatically performs a translation if one is detected as being -// required. -pref("browser.translations.autoTranslate", false); // Automatically popup an offer to translate on sites. pref("browser.translations.automaticallyPopup", true); // Simulate the behavior of using a device that does not support the translations engine. diff --git a/toolkit/components/translations/actors/TranslationsParent.sys.mjs b/toolkit/components/translations/actors/TranslationsParent.sys.mjs index ed8a2e54a154..fb46e837b7b7 100644 --- a/toolkit/components/translations/actors/TranslationsParent.sys.mjs +++ b/toolkit/components/translations/actors/TranslationsParent.sys.mjs @@ -70,12 +70,6 @@ XPCOMUtils.defineLazyPreferenceGetter( "browser.translations.enable" ); -XPCOMUtils.defineLazyPreferenceGetter( - lazy, - "autoTranslatePagePref", - "browser.translations.autoTranslate" -); - XPCOMUtils.defineLazyPreferenceGetter( lazy, "chaosErrorsPref", @@ -965,17 +959,7 @@ export class TranslationsParent extends JSWindowActorParent { return false; } - if ( - // The user has not marked this language as always translate. - !TranslationsParent.shouldAlwaysTranslateLanguage(langTags) && - // The pref to always auto-translate is off. - !lazy.autoTranslatePagePref - ) { - return false; - } - - // The page can be auto-translated - return true; + return TranslationsParent.shouldAlwaysTranslateLanguage(langTags); } /** @type {Promise | null} */ diff --git a/toolkit/components/translations/tests/browser/shared-head.js b/toolkit/components/translations/tests/browser/shared-head.js index 2e9cc73033e1..110eaff075d8 100644 --- a/toolkit/components/translations/tests/browser/shared-head.js +++ b/toolkit/components/translations/tests/browser/shared-head.js @@ -665,10 +665,14 @@ async function captureTranslationsError(callback) { * @param {Object} options - The options for `loadTestPage` plus a `runInPage` function. */ async function autoTranslatePage(options) { - const { prefs, ...otherOptions } = options; + const { prefs, languagePairs, ...otherOptions } = options; + const fromLangs = languagePairs.map(language => language.fromLang).join(","); const { cleanup, runInPage } = await loadTestPage({ autoDownloadFromRemoteSettings: true, - prefs: [["browser.translations.autoTranslate", true], ...(prefs ?? [])], + prefs: [ + ["browser.translations.alwaysTranslateLanguages", fromLangs], + ...(prefs ?? []), + ], ...otherOptions, }); await runInPage(options.runInPage);