2023-10-27 07:53:32 -05:00
|
|
|
|
--- a/browser/base/content/main-popupset.inc.xhtml
|
|
|
|
|
+++ b/browser/base/content/main-popupset.inc.xhtml
|
2024-06-15 10:17:48 -05:00
|
|
|
|
@@ -675,6 +675,8 @@
|
2023-10-27 07:53:32 -05:00
|
|
|
|
checked="false"
|
|
|
|
|
autocheck="false"
|
2024-04-18 10:57:51 -05:00
|
|
|
|
oncommand="FullPageTranslationsPanel.onNeverTranslateSite()"/>
|
2023-10-27 07:53:32 -05:00
|
|
|
|
+ <menuitem data-l10n-id="translations-panel-disable-translations"
|
2024-04-18 10:57:51 -05:00
|
|
|
|
+ oncommand="FullPageTranslationsPanel.openDisableTranslations()"/>
|
2023-10-27 07:53:32 -05:00
|
|
|
|
<menuseparator/>
|
|
|
|
|
<menuitem class="manage-languages-menuitem"
|
|
|
|
|
data-l10n-id="translations-panel-settings-manage-languages"
|
|
|
|
|
--- a/browser/components/preferences/main.inc.xhtml
|
|
|
|
|
+++ b/browser/components/preferences/main.inc.xhtml
|
2024-06-15 10:17:48 -05:00
|
|
|
|
@@ -389,8 +389,13 @@
|
2023-10-27 07:53:32 -05:00
|
|
|
|
preference="layout.spellcheckDefault"/>
|
|
|
|
|
|
|
|
|
|
<!-- Translations -->
|
|
|
|
|
- <vbox id="translationsGroup" hidden="true" data-subcategory="translations">
|
|
|
|
|
+ <vbox id="translationsGroup" data-subcategory="translations">
|
|
|
|
|
<label><html:h2 data-l10n-id="translations-manage-header"/></label>
|
|
|
|
|
+ <checkbox id="translations-manage-enable"
|
2024-06-15 10:17:48 -05:00
|
|
|
|
+ data-l10n-id="translations-manage-enable"
|
|
|
|
|
+ preference="browser.translations.enable"
|
|
|
|
|
+ data-subcategory="translations-enable" />
|
2023-10-27 07:53:32 -05:00
|
|
|
|
+ <vbox id="innerTranslationsGroup" hidden="true">
|
2024-06-15 10:17:48 -05:00
|
|
|
|
<hbox id="translations-manage-description" align="center">
|
|
|
|
|
<description flex="1" data-l10n-id="translations-manage-intro-2"/>
|
|
|
|
|
<button id="translations-manage-settings-button"
|
|
|
|
|
@@ -412,6 +417,7 @@
|
|
|
|
|
<description id="translations-manage-error" hidden="true"></description>
|
2023-10-27 07:53:32 -05:00
|
|
|
|
</vbox>
|
|
|
|
|
</vbox>
|
2024-06-15 10:17:48 -05:00
|
|
|
|
+ </vbox>
|
2023-10-27 07:53:32 -05:00
|
|
|
|
</groupbox>
|
2024-06-15 10:17:48 -05:00
|
|
|
|
|
|
|
|
|
<!-- Files and Applications -->
|
2023-10-27 07:53:32 -05:00
|
|
|
|
--- a/browser/components/preferences/main.js
|
|
|
|
|
+++ b/browser/components/preferences/main.js
|
2024-04-18 10:57:51 -05:00
|
|
|
|
@@ -144,6 +144,10 @@ Preferences.addAll([
|
2023-10-27 07:53:32 -05:00
|
|
|
|
{ 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" },
|
|
|
|
|
|
2024-04-18 10:57:51 -05:00
|
|
|
|
@@ -325,6 +329,22 @@ var gMainPane = {
|
2023-10-27 07:53:32 -05:00
|
|
|
|
|
|
|
|
|
gMainPane.initTranslations();
|
|
|
|
|
|
2023-11-25 09:44:00 -05:00
|
|
|
|
+ let inPrompt = false;
|
2023-10-27 07:53:32 -05:00
|
|
|
|
+ Preferences.get("browser.translations.enable").on("change", () => {
|
|
|
|
|
+ if(!Preferences.get("browser.translations.enable").value)
|
2023-11-25 09:44:00 -05:00
|
|
|
|
+ if(!inPrompt) {
|
|
|
|
|
+ inPrompt = true;
|
2023-10-27 07:53:32 -05:00
|
|
|
|
+ confirmRestartPrompt(false, 1, true, false).then(buttonIndex => {
|
2023-11-25 09:44:00 -05:00
|
|
|
|
+ inPrompt = false;
|
2023-10-27 07:53:32 -05:00
|
|
|
|
+ if (buttonIndex == CONFIRM_RESTART_PROMPT_RESTART_NOW) {
|
|
|
|
|
+ Services.startup.quit(
|
|
|
|
|
+ Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
2023-11-25 09:44:00 -05:00
|
|
|
|
+ }
|
2023-10-27 07:53:32 -05:00
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
if (
|
|
|
|
|
Services.prefs.getBoolPref(
|
|
|
|
|
"media.videocontrols.picture-in-picture.enabled"
|
2024-06-15 10:17:48 -05:00
|
|
|
|
@@ -789,6 +809,10 @@ var gMainPane = {
|
2023-11-25 09:44:00 -05:00
|
|
|
|
document.getElementById("checkSpelling"),
|
2023-10-27 07:53:32 -05:00
|
|
|
|
() => this.writeCheckSpelling()
|
|
|
|
|
);
|
2023-11-25 09:44:00 -05:00
|
|
|
|
+ Preferences.addSyncFromPrefListener(
|
2023-10-27 07:53:32 -05:00
|
|
|
|
+ document.getElementById("translations-manage-enable"),
|
|
|
|
|
+ () => this.readEnableTranslations()
|
|
|
|
|
+ );
|
2023-11-25 09:44:00 -05:00
|
|
|
|
Preferences.addSyncFromPrefListener(
|
2023-10-27 07:53:32 -05:00
|
|
|
|
document.getElementById("alwaysAsk"),
|
|
|
|
|
() => this.readUseDownloadDir()
|
2024-06-15 10:17:48 -05:00
|
|
|
|
@@ -1019,24 +1043,33 @@ var gMainPane = {
|
2023-10-27 07:53:32 -05:00
|
|
|
|
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.
|
2024-04-18 10:57:51 -05:00
|
|
|
|
--- a/browser/components/translations/content/fullPageTranslationsPanel.js
|
|
|
|
|
+++ b/browser/components/translations/content/fullPageTranslationsPanel.js
|
2024-06-15 10:17:48 -05:00
|
|
|
|
@@ -1225,6 +1225,15 @@ var FullPageTranslationsPanel = new (class {
|
2023-10-27 07:53:32 -05:00
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
+ openDisableTranslations() {
|
|
|
|
|
+ const window =
|
|
|
|
|
+ gBrowser.selectedBrowser.browsingContext.top.embedderElement.ownerGlobal;
|
2024-04-18 10:57:51 -05:00
|
|
|
|
+ window.openTrustedLinkIn(
|
|
|
|
|
+ "about:preferences#general-translations-enable",
|
|
|
|
|
+ "tab"
|
|
|
|
|
+ );
|
2023-10-27 07:53:32 -05:00
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
/**
|
|
|
|
|
* Redirect the user to about:preferences
|
|
|
|
|
*/
|
|
|
|
|
--- a/browser/locales/en-US/browser/translations.ftl
|
|
|
|
|
+++ b/browser/locales/en-US/browser/translations.ftl
|
2023-11-25 09:44:00 -05:00
|
|
|
|
@@ -58,6 +58,9 @@ translations-panel-settings-never-translate-unknown-language =
|
2023-10-27 07:53:32 -05:00
|
|
|
|
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.
|
|
|
|
|
|
2023-11-25 09:44:00 -05:00
|
|
|
|
@@ -123,6 +126,10 @@ translations-manage-header = Translations
|
2023-10-27 07:53:32 -05:00
|
|
|
|
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
|
2024-06-15 10:17:48 -05:00
|
|
|
|
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 =
|