Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:SquarePeg79
librewolf
_service:extract_file:fullpage-translations-cus...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:extract_file:fullpage-translations-customization.patch of Package librewolf
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"/> + <menuitem data-l10n-id="translations-panel-disable-translations" + id="translations-panel-disable-translations"/> <menuseparator/> <menuitem class="manage-languages-menuitem" data-l10n-id="translations-panel-settings-manage-languages" diff --git a/browser/base/content/main-popupset.js b/browser/base/content/main-popupset.js index c403c914f27c..6338cbd92621 100644 --- a/browser/base/content/main-popupset.js +++ b/browser/base/content/main-popupset.js @@ -251,6 +251,9 @@ document.addEventListener( case "translations-panel-settings-never-translate-site": FullPageTranslationsPanel.onNeverTranslateSite(); break; + case "translations-panel-disable-translations": + FullPageTranslationsPanel.openDisableTranslations(); + break; case "translations-panel-manage-languages": FullPageTranslationsPanel.openManageLanguages(); break; diff --git a/browser/components/preferences/main.inc.xhtml b/browser/components/preferences/main.inc.xhtml index 4c2637db10b7..846a538036d7 100644 --- a/browser/components/preferences/main.inc.xhtml +++ b/browser/components/preferences/main.inc.xhtml @@ -389,8 +389,16 @@ 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" + data-l10n-id="translations-manage-enable" + preference="browser.translations.enable" + data-subcategory="translations-enable" /> + <vbox id="innerTranslationsGroup" hidden="true"> + <checkbox id="translations-manage-autopopup" + data-l10n-id="translations-manage-autopopup" + preference="browser.translations.automaticallyPopup" /> <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 +420,7 @@ <description id="translations-manage-error" hidden="true"></description> </vbox> </vbox> + </vbox> </groupbox> <!-- Files and Applications --> 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 */ diff --git a/browser/locales/en-US/browser/translations.ftl b/browser/locales/en-US/browser/translations.ftl index e2aca3eabbe1..92d738fdf6e5 100644 --- 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 =
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor