0
Fork 0
mirror of https://codeberg.org/librewolf/source.git synced 2024-12-21 21:23:08 -05:00
LibreWolf/patches/fullpage-translations-customization.patch
Malte Jürgens 357e4d94b9
Use LibreWolf-specific translations
See https://codeberg.org/librewolf/issues/issues/2043

Squashed commit of the following:

commit 81aac91633
Author: Ricky-Tigg <Ricky-Tigg@users.noreply.translate.codeberg.org>
Date:   Tue Oct 8 09:34:25 2024 +0000

    Translated using Weblate (Finnish)

    Currently translated at 100.0% (3 of 3 strings)

    Translation: LibreWolf/browser/translations
    Translate-URL: https://translate.codeberg.org/projects/librewolf/browsertranslations/fi/

commit c6aee11b4e
Author: Ricky-Tigg <Ricky-Tigg@users.noreply.translate.codeberg.org>
Date:   Tue Oct 8 09:37:09 2024 +0000

    Translated using Weblate (Finnish)

    Currently translated at 100.0% (7 of 7 strings)

    Translation: LibreWolf/toolkit/branding/brandings
    Translate-URL: https://translate.codeberg.org/projects/librewolf/toolkitbrandingbrandings/fi/

commit c18e4cdd0e
Author: Ricky-Tigg <Ricky-Tigg@users.noreply.translate.codeberg.org>
Date:   Tue Oct 8 09:32:12 2024 +0000

    Added translation using Weblate (Finnish)

commit 20ea70ee26
Author: Ricky-Tigg <Ricky-Tigg@users.noreply.translate.codeberg.org>
Date:   Tue Oct 8 09:31:49 2024 +0000

    Added translation using Weblate (Finnish)

commit c98722de01
Author: Benny <Benny@users.noreply.translate.codeberg.org>
Date:   Sun Oct 6 19:23:30 2024 +0000

    Translated using Weblate (German)

    Currently translated at 14.0% (7 of 50 strings)

    Translation: LibreWolf/browser/preferences/preferences
    Translate-URL: https://translate.codeberg.org/projects/librewolf/browserpreferencespreferences/de/

commit 9ba6e88056
Author: Malte Jürgens <maltejur@dismail.de>
Date:   Sun Oct 6 17:49:12 2024 +0200

    Fix l10n paths

commit cae2630523
Author: maltejur <maltejur@users.noreply.translate.codeberg.org>
Date:   Sun Oct 6 14:14:05 2024 +0000

    Translated using Weblate (German)

    Currently translated at 100.0% (7 of 7 strings)

    Translation: LibreWolf/toolkit/branding/brandings
    Translate-URL: https://translate.codeberg.org/projects/librewolf/toolkitbrandingbrandings/de/

commit 6e91dfdec2
Author: maltejur <maltejur@users.noreply.translate.codeberg.org>
Date:   Sun Oct 6 14:12:08 2024 +0000

    Translated using Weblate (German)

    Currently translated at 28.5% (2 of 7 strings)

    Translation: LibreWolf/toolkit/branding/brandings
    Translate-URL: https://translate.codeberg.org/projects/librewolf/toolkitbrandingbrandings/de/

commit 5230f7b9d6
Author: Malte Jürgens <maltejur@dismail.de>
Date:   Sun Oct 6 16:13:13 2024 +0200

    Rename Firefox View

commit 1f74c5cf99
Author: maltejur <maltejur@users.noreply.translate.codeberg.org>
Date:   Sun Oct 6 14:11:46 2024 +0000

    Added translation using Weblate (German)

commit 65017ab267
Author: diivu <diivu@users.noreply.translate.codeberg.org>
Date:   Sun Oct 6 07:29:07 2024 +0000

    Translated using Weblate (Finnish)

    Currently translated at 88.0% (44 of 50 strings)

    Translation: LibreWolf/browser/preferences/preferences
    Translate-URL: https://translate.codeberg.org/projects/librewolf/browserpreferencespreferences/fi/

commit da88f487ac
Author: Benny <Benny@users.noreply.translate.codeberg.org>
Date:   Sun Oct 6 12:44:06 2024 +0000

    Translated using Weblate (German)

    Currently translated at 12.0% (6 of 50 strings)

    Translation: LibreWolf/browser/preferences/preferences
    Translate-URL: https://translate.codeberg.org/projects/librewolf/browserpreferencespreferences/de/

commit 8cc562f87a
Author: Malte Jürgens <maltejur@dismail.de>
Date:   Sun Oct 6 15:58:48 2024 +0200

    Fix l10n folder structure

commit a287b0ff64
Author: Malte Jürgens <maltejur@dismail.de>
Date:   Sun Oct 6 15:25:49 2024 +0200

    Move some patches to brandings.ftl

commit 66263ed412
Merge: 0aaa908 0fb44c4
Author: Malte Jürgens <maltejur@dismail.de>
Date:   Sun Oct 6 14:37:18 2024 +0200

    Merge remote-tracking branch 'origin/main' into l10n

commit 0aaa90890f
Author: Malte Jürgens <maltejur@dismail.de>
Date:   Sun Oct 6 14:37:08 2024 +0200

    Fix appstrings.properties

commit 376b65bbb1
Author: diivu <diivu@users.noreply.translate.codeberg.org>
Date:   Sun Oct 6 07:24:56 2024 +0000

    Added translation using Weblate (Finnish)

commit 963c276a24
Author: Malte Jürgens <maltejur@dismail.de>
Date:   Sun Sep 29 14:45:36 2024 +0200

    Use wget in l10n script for consistency

commit d0e0ef0769
Author: kratos <kratos@users.noreply.translate.codeberg.org>
Date:   Fri Sep 27 14:01:32 2024 +0000

    Translated using Weblate (Hungarian)

    Currently translated at 100.0% (3 of 3 strings)

    Translation: LibreWolf/browser/translations
    Translate-URL: https://translate.codeberg.org/projects/librewolf/browsertranslations/hu/

commit db529f8ce1
Author: kratos <kratos@users.noreply.translate.codeberg.org>
Date:   Fri Sep 27 14:01:01 2024 +0000

    Added translation using Weblate (Hungarian)

commit a9fb722578
Author: kratos <kratos@users.noreply.translate.codeberg.org>
Date:   Fri Sep 27 13:51:48 2024 +0000

    Translated using Weblate (Hungarian)

    Currently translated at 100.0% (50 of 50 strings)

    Translation: LibreWolf/browser/preferences/preferences
    Translate-URL: https://translate.codeberg.org/projects/librewolf/browserpreferencespreferences/hu/

commit a54b7cdb5e
Author: Umeaman <Umeaman@users.noreply.translate.codeberg.org>
Date:   Wed Sep 25 23:36:20 2024 +0000

    Translated using Weblate (Swedish)

    Currently translated at 10.0% (5 of 50 strings)

    Translation: LibreWolf/browser/preferences/preferences
    Translate-URL: https://translate.codeberg.org/projects/librewolf/browserpreferencespreferences/sv/

commit 555586291d
Author: Umeaman <Umeaman@users.noreply.translate.codeberg.org>
Date:   Wed Sep 25 23:36:02 2024 +0000

    Added translation using Weblate (Swedish)

commit 65662b49a5
Author: kratos <kratos@users.noreply.translate.codeberg.org>
Date:   Mon Sep 23 18:23:02 2024 +0000

    Translated using Weblate (Hungarian)

    Currently translated at 16.0% (8 of 50 strings)

    Translation: LibreWolf/browser/preferences/preferences
    Translate-URL: https://translate.codeberg.org/projects/librewolf/browserpreferencespreferences/hu/

commit 1460588363
Author: kratos <kratos@users.noreply.translate.codeberg.org>
Date:   Mon Sep 23 18:22:00 2024 +0000

    Added translation using Weblate (Hungarian)

commit 78667d9c9c
Author: maltejur <maltejur@users.noreply.translate.codeberg.org>
Date:   Thu Sep 19 15:54:14 2024 +0000

    Translated using Weblate (German)

    Currently translated at 10.0% (5 of 50 strings)

    Translation: LibreWolf/browser/preferences/preferences
    Translate-URL: https://translate.codeberg.org/projects/librewolf/browserpreferencespreferences/de/

commit dc948492ef
Author: Malte Juergens <maltejur@dismail.de>
Date:   Thu Sep 19 17:50:18 2024 +0200

    Remove appstrings.properties override

commit b92da6c9b6
Author: Malte Juergens <maltejur@dismail.de>
Date:   Thu Sep 19 17:49:49 2024 +0200

    Use dashes in language codes

commit b49b4b1661
Author: Malte Juergens <maltejur@dismail.de>
Date:   Thu Sep 19 17:42:01 2024 +0200

    Fix syntax error in old python version

commit eed271897f
Author: Malte Juergens <maltejur@dismail.de>
Date:   Wed Sep 18 01:44:57 2024 +0200

    Make lw translations work

commit f8c5b9e264
Author: Allan Nordhøy <epost@anotheragency.no>
Date:   Mon Sep 16 10:31:25 2024 +0000

    Translated using Weblate (Norwegian Bokmål)

    Currently translated at 100.0% (3 of 3 strings)

    Translation: LibreWolf/browser/translations.ftl
    Translate-URL: https://hosted.weblate.org/projects/librewolf/browsertranslationsftl/nb_NO/

commit 4accda62a1
Author: Allan Nordhøy <epost@anotheragency.no>
Date:   Mon Sep 16 10:43:25 2024 +0000

    Translated using Weblate (German)

    Currently translated at 8.0% (4 of 50 strings)

    Translation: LibreWolf/browser/preferences/preferences.ftl
    Translate-URL: https://hosted.weblate.org/projects/librewolf/browserpreferencespreferencesftl/de/

commit e09583f951
Author: Allan Nordhøy <epost@anotheragency.no>
Date:   Mon Sep 16 10:43:41 2024 +0000

    Translated using Weblate (French)

    Currently translated at 98.0% (49 of 50 strings)

    Translation: LibreWolf/browser/preferences/preferences.ftl
    Translate-URL: https://hosted.weblate.org/projects/librewolf/browserpreferencespreferencesftl/fr/

commit 08bebb1a5c
Author: Allan Nordhøy <epost@anotheragency.no>
Date:   Mon Sep 16 10:43:41 2024 +0000

    Translated using Weblate (English (United States))

    Currently translated at 100.0% (50 of 50 strings)

    Translation: LibreWolf/browser/preferences/preferences.ftl
    Translate-URL: https://hosted.weblate.org/projects/librewolf/browserpreferencespreferencesftl/en_US/

commit b07795c146
Author: Allan Nordhøy <epost@anotheragency.no>
Date:   Sun Sep 15 11:59:46 2024 +0200

    Added translation using Weblate (Norwegian Bokmål)

commit c67532071f
Author: Malte Jürgens <maltejur@dismail.de>
Date:   Fri Sep 13 23:02:08 2024 +0000

    Translated using Weblate (French)

    Currently translated at 66.6% (2 of 3 strings)

    Translation: LibreWolf/browser/translations.ftl
    Translate-URL: https://hosted.weblate.org/projects/librewolf/browsertranslationsftl/fr/

commit 9b19745b7c
Author: Malte Jürgens <maltejur@dismail.de>
Date:   Sat Sep 14 01:01:08 2024 +0200

    Added translation using Weblate (French)

commit a51d08cc03
Author: Malte Jürgens <maltejur@dismail.de>
Date:   Sat Sep 14 00:59:14 2024 +0200

    Deleted translation using Weblate (French)

commit 8f5cdd20b5
Author: Malte Jürgens <maltejur@dismail.de>
Date:   Sat Sep 14 00:58:35 2024 +0200

    Added translation using Weblate (French)

commit 0a827abfd6
Author: Malte Juergens <maltejur@dismail.de>
Date:   Sat Sep 14 00:57:29 2024 +0200

    Move translations patches/fullpage-translations-customization.patch into own *.ftl file

commit dcd910c672
Author: Malte Jürgens <maltejur@dismail.de>
Date:   Fri Sep 13 22:34:22 2024 +0000

    Translated using Weblate (German)

    Currently translated at 6.0% (3 of 50 strings)

    Translation: LibreWolf/browser/preferences/preferences.ftl
    Translate-URL: https://hosted.weblate.org/projects/librewolf/browserpreferencespreferencesftl/de/

commit 31851a6026
Author: Malte Jürgens <maltejur@dismail.de>
Date:   Sat Sep 14 00:33:16 2024 +0200

    Added translation using Weblate (German)

commit bc3d695711
Author: Malte Juergens <maltejur@dismail.de>
Date:   Fri Sep 13 23:21:29 2024 +0200

    Add French pref-pane Translations provided by @Acideburn

    Co-authored-by: Acideburn <Acideburn@noreply.codeberg.org>

commit 3072c26e4f
Author: Malte Juergens <maltejur@dismail.de>
Date:   Tue Sep 10 16:52:58 2024 +0200

    Allow translation of LW strings
2024-10-11 22:28:01 +02:00

164 lines
6.3 KiB
Diff

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
*/