Skip to content

Commit c18ddea

Browse files
committed
Bug 1817084 - Remove old translations code; r=settings-reviewers,fluent-reviewers,nordzilla,mconley,flod
Differential Revision: https://phabricator.services.mozilla.com/D181700
1 parent 3650d1d commit c18ddea

30 files changed

+4
-4035
lines changed

browser/app/profile/firefox.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1814,19 +1814,10 @@ pref("media.videocontrols.picture-in-picture.video-toggle.visibility-threshold",
18141814
pref("media.videocontrols.picture-in-picture.keyboard-controls.enabled", true);
18151815
pref("media.videocontrols.picture-in-picture.urlbar-button.enabled", true);
18161816

1817-
// Preferences for the older translation service backed by external services. This is
1818-
// planned to be replaced with an integration of the Firefox Translations service.
1819-
// The prefs for the new service are located under "browser.translations" in
1820-
// modules/libpref/init/all.js
1821-
//
1822-
// See Bug 971044.
1823-
pref("browser.translation.detectLanguage", false);
1817+
// TODO (Bug 1817084) - This pref is used for managing translation preferences
1818+
// in the Firefox Translations addon. It should be removed when the addon is
1819+
// removed.
18241820
pref("browser.translation.neverForLanguages", "");
1825-
// Show the older translation UI that uses external services. This includes UI such as
1826-
// the info bar, notification icon and preferences.
1827-
pref("browser.translation.ui.show", false);
1828-
// Allows to define the translation engine. Google is default, Bing or Yandex are other options.
1829-
pref("browser.translation.engine", "Google");
18301821

18311822
// Enable Firefox translations powered by the Bergamot translations
18321823
// engine https://browser.mt/. See Bug 971044.

browser/base/content/browser.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ ChromeUtils.defineESModuleGetters(this, {
9999

100100
XPCOMUtils.defineLazyModuleGetters(this, {
101101
CFRPageActions: "resource://activity-stream/lib/CFRPageActions.jsm",
102-
Translation: "resource:///modules/translation/TranslationParent.jsm",
103102
});
104103

105104
XPCOMUtils.defineLazyGetter(this, "fxAccounts", () => {

browser/base/content/test/static/browser_all_files_referenced.js

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,6 @@ if (AppConstants.MOZ_BACKGROUNDTASKS) {
8989
gExceptionPaths.push("resource://app/modules/backgroundtasks/");
9090
}
9191

92-
// Bug 1710546 https://bugzilla.mozilla.org/show_bug.cgi?id=1710546
93-
if (AppConstants.NIGHTLY_BUILD) {
94-
gExceptionPaths.push("resource://builtin-addons/translations/");
95-
}
96-
9792
// Temporary allowlist for shopping - we'll reference this soon.
9893
if (AppConstants.NIGHTLY_BUILD) {
9994
gExceptionPaths.push("chrome://browser/content/shopping/shopping.html");
@@ -212,11 +207,6 @@ var whitelist = [
212207
{ file: "resource://pdf.js/web/debugger.js" },
213208
{ file: "resource://pdf.js/web/debugger.css" },
214209

215-
// resource://app/modules/translation/TranslationContentHandler.jsm
216-
{ file: "resource://app/modules/translation/BingTranslator.jsm" },
217-
{ file: "resource://app/modules/translation/GoogleTranslator.jsm" },
218-
{ file: "resource://app/modules/translation/YandexTranslator.jsm" },
219-
220210
// Starting from here, files in the whitelist are bugs that need fixing.
221211
// Bug 1339424 (wontfix?)
222212
{

browser/components/BrowserGlue.sys.mjs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -771,22 +771,6 @@ let JSWINDOWACTORS = {
771771
allFrames: true,
772772
},
773773

774-
// The older translations feature backed by external services.
775-
// This is being replaced by a newer ML-backed translation service. See Bug 971044.
776-
Translation: {
777-
parent: {
778-
moduleURI: "resource:///modules/translation/TranslationParent.jsm",
779-
},
780-
child: {
781-
moduleURI: "resource:///modules/translation/TranslationChild.jsm",
782-
events: {
783-
pageshow: {},
784-
load: { mozSystemGroup: true, capture: true },
785-
},
786-
},
787-
enablePreference: "browser.translation.detectLanguage",
788-
},
789-
790774
UITour: {
791775
parent: {
792776
esModuleURI: "resource:///modules/UITourParent.sys.mjs",

browser/components/moz.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ DIRS += [
5858
"syncedtabs",
5959
"tabunloader",
6060
"textrecognition",
61-
"translation",
6261
"translations",
6362
"uitour",
6463
"urlbar",

browser/components/preferences/main.inc.xhtml

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -355,25 +355,7 @@
355355
data-l10n-args='{"localeName": "und"}'
356356
preference="intl.regional_prefs.use_os_locales"/>
357357

358-
<!-- TODO (Bug 1817084) This older implementation will be removed soon -->
359-
<hbox id="translationBox" hidden="true">
360-
<hbox align="center" flex="1">
361-
<checkbox id="translate" preference="browser.translation.detectLanguage"
362-
data-l10n-id="translate-web-pages"/>
363-
<hbox id="bingAttribution" hidden="true" align="center">
364-
<label data-l10n-id="translate-attribution">
365-
<html:img id="translationAttributionImage" aria-label="Microsoft Translator"
366-
src="chrome://browser/content/microsoft-translator-attribution.png"
367-
data-l10n-name="logo"/>
368-
</label>
369-
</hbox>
370-
</hbox>
371-
<button id="translateButton"
372-
is="highlightable-button"
373-
class="accessory-button"
374-
data-l10n-id="translate-exceptions"/>
375-
</hbox>
376-
358+
<!-- This Firefox Translations UI manages the prefs for the addon only. -->
377359
<hbox id="fxtranslationsBox" hidden="true" data-subcategory="fxtranslations">
378360
<description flex="1" control="fxtranslateButton" data-l10n-id="fx-translate-web-pages"/>
379361
<button id="fxtranslateButton"

browser/components/preferences/main.js

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ Preferences.addAll([
9898
{ id: "font.language.group", type: "wstring" },
9999

100100
// Languages
101-
{ id: "browser.translation.detectLanguage", type: "bool" },
102101
{ id: "intl.regional_prefs.use_os_locales", type: "bool" },
103102

104103
// General tab
@@ -439,17 +438,6 @@ var gMainPane = {
439438
makeDisableControllingExtension(PREF_SETTING_TYPE, CONTAINERS_KEY)
440439
);
441440
setEventListener("chooseLanguage", "command", gMainPane.showLanguages);
442-
setEventListener(
443-
"translationAttributionImage",
444-
"click",
445-
gMainPane.openTranslationProviderAttribution
446-
);
447-
// TODO (Bug 1817084) Remove this code when we disable the extension
448-
setEventListener(
449-
"translateButton",
450-
"command",
451-
gMainPane.showTranslationExceptions
452-
);
453441
// TODO (Bug 1817084) Remove this code when we disable the extension
454442
setEventListener(
455443
"fxtranslateButton",
@@ -513,20 +501,6 @@ var gMainPane = {
513501

514502
this.updateOnScreenKeyboardVisibility();
515503

516-
// Show translation preferences if we may:
517-
const translationsPrefName = "browser.translation.ui.show";
518-
if (Services.prefs.getBoolPref(translationsPrefName)) {
519-
let row = document.getElementById("translationBox");
520-
row.removeAttribute("hidden");
521-
// Showing attribution only for Bing Translator.
522-
var { Translation } = ChromeUtils.import(
523-
"resource:///modules/translation/TranslationParent.jsm"
524-
);
525-
if (Translation.translationEngine == "Bing") {
526-
document.getElementById("bingAttribution").removeAttribute("hidden");
527-
}
528-
}
529-
530504
// Firefox Translations settings panel
531505
// TODO (Bug 1817084) Remove this code when we disable the extension
532506
const fxtranslationsDisabledPrefName = "extensions.translations.disabled";
@@ -750,14 +724,6 @@ var gMainPane = {
750724
document.getElementById("defaultFont"),
751725
element => FontBuilder.readFontSelection(element)
752726
);
753-
Preferences.addSyncFromPrefListener(
754-
document.getElementById("translate"),
755-
() =>
756-
this.updateButtons(
757-
"translateButton",
758-
"browser.translation.detectLanguage"
759-
)
760-
);
761727
Preferences.addSyncFromPrefListener(
762728
document.getElementById("checkSpelling"),
763729
() => this.readCheckSpelling()
@@ -1932,13 +1898,6 @@ var gMainPane = {
19321898
);
19331899
},
19341900

1935-
openTranslationProviderAttribution() {
1936-
var { Translation } = ChromeUtils.import(
1937-
"resource:///modules/translation/TranslationParent.jsm"
1938-
);
1939-
Translation.openProviderAttribution();
1940-
},
1941-
19421901
/**
19431902
* Displays the fonts dialog, where web page font names and sizes can be
19441903
* configured.

0 commit comments

Comments
 (0)