--- a/browser/base/content/main-popupset.inc.xhtml
+++ b/browser/base/content/main-popupset.inc.xhtml
@@ -675,6 +675,8 @@
checked="false"
autocheck="false"
oncommand="FullPageTranslationsPanel.onNeverTranslateSite()"/>
+
-
+
+
+
+
--- a/browser/components/preferences/main.js
+++ b/browser/components/preferences/main.js
@@ -144,6 +144,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" },
@@ -325,6 +329,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"
@@ -789,6 +809,10 @@ var gMainPane = {
document.getElementById("checkSpelling"),
() => this.writeCheckSpelling()
);
+ Preferences.addSyncFromPrefListener(
+ document.getElementById("translations-manage-enable"),
+ () => this.readEnableTranslations()
+ );
Preferences.addSyncFromPrefListener(
document.getElementById("alwaysAsk"),
() => this.readUseDownloadDir()
@@ -1019,24 +1043,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.
--- a/browser/components/translations/content/fullPageTranslationsPanel.js
+++ b/browser/components/translations/content/fullPageTranslationsPanel.js
@@ -1225,6 +1225,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
*/
--- a/browser/locales/en-US/browser/translations.ftl
+++ b/browser/locales/en-US/browser/translations.ftl
@@ -58,6 +58,9 @@ translations-panel-settings-never-translate-unknown-language =
translations-panel-settings-never-translate-site =
.label = Never translate this site
+translations-panel-disable-translations =
+ .label = Disable translations completely
+
## The translation panel appears from the url bar, and this view is the default
## translation view.
@@ -123,6 +126,10 @@ translations-manage-header = Translations
translations-manage-settings-button =
.label = Settings…
.accesskey = t
+translations-manage-enable =
+ .label = Enable fullpage translations
+translations-manage-autopopup =
+ .label = Prompt to translate pages that aren’t in the browser’s configured language
translations-manage-intro-2 = Set your language and site translation preferences and manage languages downloaded for offline translation.
translations-manage-download-description = Download languages for offline translation
translations-manage-language-download-button =