diff --git a/browser/base/content/main-popupset.inc.xhtml b/browser/base/content/main-popupset.inc.xhtml
index 1fb595272a18..56c2c58e111c 100644
--- a/browser/base/content/main-popupset.inc.xhtml
+++ b/browser/base/content/main-popupset.inc.xhtml
@@ -607,6 +607,8 @@
checked="false"
autocheck="false"
id="translations-panel-settings-never-translate-site"/>
+
-
+
+
+
+
+
diff --git a/browser/components/preferences/main.js b/browser/components/preferences/main.js
index fec5aa685ea7..92082d259903 100644
--- a/browser/components/preferences/main.js
+++ b/browser/components/preferences/main.js
@@ -145,6 +145,10 @@ Preferences.addAll([
{ id: "dom.ipc.processCount.web", type: "int" },
{ id: "layers.acceleration.disabled", type: "bool", inverted: true },
+ /* Fullpage Translations */
+ { id: "browser.translations.enable", type: "bool" },
+ { id: "browser.translations.automaticallyPopup", type: "bool" },
+
// Files and Applications
{ id: "pref.downloads.disable_button.edit_actions", type: "bool" },
@@ -326,6 +330,22 @@ var gMainPane = {
gMainPane.initTranslations();
+ let inPrompt = false;
+ Preferences.get("browser.translations.enable").on("change", () => {
+ if(!Preferences.get("browser.translations.enable").value)
+ if(!inPrompt) {
+ inPrompt = true;
+ confirmRestartPrompt(false, 1, true, false).then(buttonIndex => {
+ inPrompt = false;
+ if (buttonIndex == CONFIRM_RESTART_PROMPT_RESTART_NOW) {
+ Services.startup.quit(
+ Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart
+ );
+ }
+ });
+ }
+ });
+
if (
Services.prefs.getBoolPref(
"media.videocontrols.picture-in-picture.enabled"
@@ -793,6 +813,10 @@ var gMainPane = {
document.getElementById("checkSpelling"),
() => this.writeCheckSpelling()
);
+ Preferences.addSyncFromPrefListener(
+ document.getElementById("translations-manage-enable"),
+ () => this.readEnableTranslations()
+ );
Preferences.addSyncFromPrefListener(
document.getElementById("alwaysAsk"),
() => this.readUseDownloadDir()
@@ -1023,24 +1047,33 @@ var gMainPane = {
document.getElementById("zoomBox").hidden = false;
},
+ readEnableTranslations(skipInit = false) {
+ const translationsEnabled = Preferences.get("browser.translations.enable").value;
+ document.getElementById("innerTranslationsGroup").hidden = !translationsEnabled;
+ if (!this._translationsInitialized && !skipInit)
+ this.initTranslations();
+ },
+
+ _translationsInitialized: false,
+
/**
* Initialize the translations view.
*/
async initTranslations() {
+ this.readEnableTranslations(true);
+
if (!Services.prefs.getBoolPref("browser.translations.enable")) {
return;
}
+ this._translationsInitialized = true;
+
/**
* Which phase a language download is in.
*
* @typedef {"downloaded" | "loading" | "uninstalled"} DownloadPhase
*/
- // Immediately show the group so that the async load of the component does
- // not cause the layout to jump. The group will be empty initially.
- document.getElementById("translationsGroup").hidden = false;
-
class TranslationsState {
/**
* The fully initialized state.
diff --git a/browser/components/translations/content/fullPageTranslationsPanel.js b/browser/components/translations/content/fullPageTranslationsPanel.js
index 0c8288af9aca..05e49c06ff63 100644
--- a/browser/components/translations/content/fullPageTranslationsPanel.js
+++ b/browser/components/translations/content/fullPageTranslationsPanel.js
@@ -1220,6 +1220,15 @@ var FullPageTranslationsPanel = new (class {
);
}
+ openDisableTranslations() {
+ const window =
+ gBrowser.selectedBrowser.browsingContext.top.embedderElement.ownerGlobal;
+ window.openTrustedLinkIn(
+ "about:preferences#general-translations-enable",
+ "tab"
+ );
+ }
+
/**
* Redirect the user to about:preferences
*/