tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 25796bd80fdff7e08118cd41f3653923066ee2f4
parent e0dcb037e3fd3740676d19b1c0ffef9ee44d2d19
Author: Erik Nordin <enordin@mozilla.com>
Date:   Thu, 18 Dec 2025 01:17:25 +0000

Bug 2002127 - Part 05: Implement Top-Level Translations Setting Group r=fluent-reviewers,bolsson,hjones

This commit implements the top-level Translations settings for the new
about:settings UI, compatible with the settings redesign initiative.

Differential Revision: https://phabricator.services.mozilla.com/D274222

Diffstat:
Mbrowser/components/preferences/main.inc.xhtml | 13++++++++++---
Mbrowser/components/preferences/main.js | 35+++++++++++++++++++++++++++++++++++
Mbrowser/locales/en-US/browser/preferences/preferences.ftl | 12++++++++++++
3 files changed, 57 insertions(+), 3 deletions(-)

diff --git a/browser/components/preferences/main.inc.xhtml b/browser/components/preferences/main.inc.xhtml @@ -215,7 +215,10 @@ data-l10n-args='{"localeName": "und"}' preference="intl.regional_prefs.use_os_locales"/> - <!-- This Firefox Translations UI manages the prefs for the addon only. --> + <!-- This Translations UI manages the prefs for the addon only. + We were planning to remove this once ESR 115 went away, but it seems + that it may live forever. I think it can be safely removed from a current + version of Firefox, though, especially once the Settings Redesign is finalized. --> <hbox id="fxtranslationsBox" hidden="true" data-subcategory="fxtranslations"> <description flex="1" control="fxtranslateButton" data-l10n-id="fx-translate-web-pages"/> <button id="fxtranslateButton" @@ -228,8 +231,9 @@ data-l10n-id="check-user-spelling" preference="layout.spellcheckDefault"/> - <!-- Translations --> - <vbox id="translationsGroup" hidden="true" data-subcategory="translations"> + <!-- This Translations UI is the pre-settings-redesign UI and should be removed + when getting ready for the settings redesign to fully ship. --> + <vbox id="translationsGroup" data-srd-groupid="translations" hidden="true" data-subcategory="translations"> <label><html:h2 data-l10n-id="translations-manage-header"/></label> <hbox id="translations-manage-description" align="center"> <description flex="1" data-l10n-id="translations-manage-intro-2"/> @@ -254,6 +258,9 @@ </vbox> </groupbox> +<!-- This Translations UI is compatible with the settings redesign --> +<html:setting-group data-category="paneGeneral" groupid="translations" hidden="true"/> + <!-- Files and Applications --> <hbox id="filesAndApplicationsCategory" class="subcategory" diff --git a/browser/components/preferences/main.js b/browser/components/preferences/main.js @@ -204,6 +204,9 @@ Preferences.addAll([ // Appearance { id: "layout.css.prefers-color-scheme.content-override", type: "int" }, + + // Translations + { id: "browser.translations.automaticallyPopup", type: "bool" }, ]); if (AppConstants.HAVE_SHELL_SERVICE) { @@ -646,6 +649,19 @@ Preferences.addSetting({ Preferences.addSetting({ id: "containersPlaceholder" }); Preferences.addSetting({ + id: "offerTranslations", + pref: "browser.translations.automaticallyPopup", +}); + +Preferences.addSetting({ + id: "translationsManageButton", + onUserClick(e) { + e.preventDefault(); + gMainPane.showTranslationsSettings(); + }, +}); + +Preferences.addSetting({ id: "data-migration", visible: () => !Services.policies || Services.policies.isAllowed("profileImport"), @@ -2247,6 +2263,24 @@ SettingGroupManager.registerGroups({ }, ], }, + translations: { + inProgress: true, + l10nId: "settings-translations-header", + iconSrc: "chrome://browser/skin/translations.svg", + supportPage: "website-translation", + headingLevel: 2, + items: [ + { + id: "offerTranslations", + l10nId: "settings-translations-offer-to-translate-label", + }, + { + id: "translationsManageButton", + l10nId: "settings-translations-more-settings-button", + control: "moz-box-button", + }, + ], + }, appearance: { l10nId: "web-appearance-group", items: [ @@ -3783,6 +3817,7 @@ var gMainPane = { initSettingGroup("browsing"); initSettingGroup("zoom"); initSettingGroup("support"); + initSettingGroup("translations"); initSettingGroup("performance"); initSettingGroup("startup"); initSettingGroup("importBrowserData"); diff --git a/browser/locales/en-US/browser/preferences/preferences.ftl b/browser/locales/en-US/browser/preferences/preferences.ftl @@ -421,6 +421,18 @@ translate-exceptions = .label = Exceptions… .accesskey = x +settings-translations-header = + .label = Translations + .aria-label = Translations + .description = Translate pages or selected text. To protect your privacy, translations stay on your device. + +settings-translations-offer-to-translate-label = + .label = Offer full page translation + +settings-translations-more-settings-button = + .label = More translation settings + .description = Set preferences for languages, websites, and offline translation. + # Variables: # $localeName (string) - Localized name of the locale to be used. use-system-locale =