From eed886e7e2bcc50748b9724a19b20a80ba3bf7bb Mon Sep 17 00:00:00 2001 From: Erica Wright Date: Fri, 8 Jan 2021 07:34:44 +0000 Subject: [PATCH] Bug 1685133 - String changes due to newtab updates r=preferences-reviewers,prathiksha,fluent-reviewers,flod,ntim Differential Revision: https://phabricator.services.mozilla.com/D100819 --- .../customizableui/content/panelUI.js | 19 +++++++++++++++++++ .../components/TopSites/TopSiteForm.jsx | 16 +++++++++++++--- .../components/TopSites/TopSites.jsx | 6 ++++-- .../data/content/activity-stream.bundle.js | 13 +++++++++---- .../components/preferences/privacy.inc.xhtml | 2 +- browser/components/preferences/privacy.js | 18 ++++++++++++++++++ browser/locales/en-US/browser/browser.ftl | 1 + .../locales/en-US/browser/newtab/newtab.ftl | 2 ++ .../en-US/browser/preferences/preferences.ftl | 4 ++++ 9 files changed, 71 insertions(+), 10 deletions(-) diff --git a/browser/components/customizableui/content/panelUI.js b/browser/components/customizableui/content/panelUI.js index e079183ff5fc..e706b921531b 100644 --- a/browser/components/customizableui/content/panelUI.js +++ b/browser/components/customizableui/content/panelUI.js @@ -569,6 +569,25 @@ const PanelUI = { ); } + // When these prefs are made the default, add this data-l10n-id directly to browser.xhtml. + if ( + Services.prefs.getBoolPref( + "browser.newtabpage.activity-stream.customizationMenu.enabled" + ) || + Services.prefs.getBoolPref( + "browser.newtabpage.activity-stream.newNewtabExperience.enabled" + ) + ) { + this.libraryRecentHighlights.previousElementSibling.setAttribute( + "data-l10n-id", + "library-recent-activity-label" + ); + } else { + this.libraryRecentHighlights.previousElementSibling.removeAttribute( + "data-l10n-id" + ); + } + // Make the elements invisible synchronously, before the view is shown. this.makeLibraryRecentHighlightsInvisible(); diff --git a/browser/components/newtab/content-src/components/TopSites/TopSiteForm.jsx b/browser/components/newtab/content-src/components/TopSites/TopSiteForm.jsx index 67d64eee252e..258f74948666 100644 --- a/browser/components/newtab/content-src/components/TopSites/TopSiteForm.jsx +++ b/browser/components/newtab/content-src/components/TopSites/TopSiteForm.jsx @@ -238,15 +238,25 @@ export class TopSiteForm extends React.PureComponent { const onSubmit = previewMode ? this.onPreviewButtonClick : this.onDoneButtonClick; + + // When the newNewtabExperience is enabled by default, use only shortcut ids. + const addTopsitesHeaderL10nId = + this.props.newNewtabExperienceEnabled || + this.props.customizationMenuEnabled + ? "newtab-topsites-add-shortcut-header" + : "newtab-topsites-add-topsites-header"; + const editTopsitesHeaderL10nId = + this.props.newNewtabExperienceEnabled || + this.props.customizationMenuEnabled + ? "newtab-topsites-edit-shortcut-header" + : "newtab-topsites-edit-topsites-header"; return (

diff --git a/browser/components/newtab/content-src/components/TopSites/TopSites.jsx b/browser/components/newtab/content-src/components/TopSites/TopSites.jsx index 8b42f05a2755..2c9419cb4293 100644 --- a/browser/components/newtab/content-src/components/TopSites/TopSites.jsx +++ b/browser/components/newtab/content-src/components/TopSites/TopSites.jsx @@ -141,6 +141,8 @@ export class _TopSites extends React.PureComponent { const extraMenuOptions = ["AddTopSite"]; const newNewtabExperienceEnabled = props.Prefs.values["newNewtabExperience.enabled"]; + const customizationMenuEnabled = + props.Prefs.values["customizationMenu.enabled"]; const colors = props.Prefs.values["newNewtabExperience.colors"]; if (props.Prefs.values["improvesearch.topSiteSearchShortcuts"]) { @@ -148,8 +150,7 @@ export class _TopSites extends React.PureComponent { } const canShowCustomizationMenu = - props.Prefs.values["newNewtabExperience.enabled"] || - props.Prefs.values["customizationMenu.enabled"]; + newNewtabExperienceEnabled || customizationMenuEnabled; const hideTitle = props.Prefs.values.hideTopSitesTitle || canShowCustomizationMenu; @@ -205,6 +206,7 @@ export class _TopSites extends React.PureComponent { dispatch={this.props.dispatch} {...editForm} newNewtabExperienceEnabled={newNewtabExperienceEnabled} + customizationMenuEnabled={customizationMenuEnabled} />
diff --git a/browser/components/newtab/data/content/activity-stream.bundle.js b/browser/components/newtab/data/content/activity-stream.bundle.js index d4007b3fb2de..5a94af32a077 100644 --- a/browser/components/newtab/data/content/activity-stream.bundle.js +++ b/browser/components/newtab/data/content/activity-stream.bundle.js @@ -8618,13 +8618,14 @@ class _TopSites extends react__WEBPACK_IMPORTED_MODULE_6___default.a.PureCompone } = props.TopSites; const extraMenuOptions = ["AddTopSite"]; const newNewtabExperienceEnabled = props.Prefs.values["newNewtabExperience.enabled"]; + const customizationMenuEnabled = props.Prefs.values["customizationMenu.enabled"]; const colors = props.Prefs.values["newNewtabExperience.colors"]; if (props.Prefs.values["improvesearch.topSiteSearchShortcuts"]) { extraMenuOptions.push("AddSearchShortcut"); } - const canShowCustomizationMenu = props.Prefs.values["newNewtabExperience.enabled"] || props.Prefs.values["customizationMenu.enabled"]; + const canShowCustomizationMenu = newNewtabExperienceEnabled || customizationMenuEnabled; const hideTitle = props.Prefs.values.hideTopSitesTitle || canShowCustomizationMenu; // `collapsed` should be sent to CollapsibleSection as undefined if // `props.TopSites.pref` is not set to true. @@ -8674,7 +8675,8 @@ class _TopSites extends react__WEBPACK_IMPORTED_MODULE_6___default.a.PureCompone onClose: this.onEditFormClose, dispatch: this.props.dispatch }, editForm, { - newNewtabExperienceEnabled: newNewtabExperienceEnabled + newNewtabExperienceEnabled: newNewtabExperienceEnabled, + customizationMenuEnabled: customizationMenuEnabled })))), showSearchShortcutsForm && react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement("div", { className: "edit-search-shortcuts" }, react__WEBPACK_IMPORTED_MODULE_6___default.a.createElement(_asrouter_components_ModalOverlay_ModalOverlay__WEBPACK_IMPORTED_MODULE_5__["ModalOverlayWrapper"], { @@ -15842,7 +15844,10 @@ class TopSiteForm_TopSiteForm extends external_React_default.a.PureComponent { } // Handles the form submit so an enter press performs the correct action - const onSubmit = previewMode ? this.onPreviewButtonClick : this.onDoneButtonClick; + const onSubmit = previewMode ? this.onPreviewButtonClick : this.onDoneButtonClick; // When the newNewtabExperience is enabled by default, use only "newtab-topsites-add-shortcut-header". + + const addTopsitesHeaderL10nId = this.props.newNewtabExperienceEnabled || this.props.customizationMenuEnabled ? "newtab-topsites-add-shortcut-header" : "newtab-topsites-add-topsites-header"; + const editTopsitesHeaderL10nId = this.props.newNewtabExperienceEnabled || this.props.customizationMenuEnabled ? "newtab-topsites-edit-shortcut-header" : "newtab-topsites-edit-topsites-header"; return external_React_default.a.createElement("form", { className: "topsite-form", onSubmit: onSubmit @@ -15850,7 +15855,7 @@ class TopSiteForm_TopSiteForm extends external_React_default.a.PureComponent { className: "form-input-container" }, external_React_default.a.createElement("h3", { className: "section-title grey-title", - "data-l10n-id": showAsAdd ? "newtab-topsites-add-topsites-header" : "newtab-topsites-edit-topsites-header" + "data-l10n-id": showAsAdd ? addTopsitesHeaderL10nId : editTopsitesHeaderL10nId }), external_React_default.a.createElement("div", { className: "fields-and-preview" }, external_React_default.a.createElement("div", { diff --git a/browser/components/preferences/privacy.inc.xhtml b/browser/components/preferences/privacy.inc.xhtml index f0345939101b..09d66e136d81 100644 --- a/browser/components/preferences/privacy.inc.xhtml +++ b/browser/components/preferences/privacy.inc.xhtml @@ -630,7 +630,7 @@ preference="browser.urlbar.suggest.bookmark"/> - diff --git a/browser/components/preferences/privacy.js b/browser/components/preferences/privacy.js index 70c00ca9badf..0706f9e8bae9 100644 --- a/browser/components/preferences/privacy.js +++ b/browser/components/preferences/privacy.js @@ -729,6 +729,24 @@ var gPrivacyPane = { } } + // When these prefs are made the default, add this data-l10n-id directly to privacy.inc.xhtml. + if ( + Services.prefs.getBoolPref( + "browser.newtabpage.activity-stream.newNewtabExperience.enabled" + ) || + Services.prefs.getBoolPref( + "browser.newtabpage.activity-stream.customizationMenu.enabled" + ) + ) { + document + .getElementById("topSitesSuggestion") + .setAttribute("data-l10n-id", "addressbar-locbar-shortcuts-option"); + } else { + document + .getElementById("topSitesSuggestion") + .setAttribute("data-l10n-id", "addressbar-locbar-topsites-option"); + } + this.initSiteDataControls(); setEventListener( "clearSiteDataButton", diff --git a/browser/locales/en-US/browser/browser.ftl b/browser/locales/en-US/browser/browser.ftl index 16ab4dc9a1aa..3af027958570 100644 --- a/browser/locales/en-US/browser/browser.ftl +++ b/browser/locales/en-US/browser/browser.ftl @@ -585,6 +585,7 @@ library-bookmarks-bookmark-this-page = .label = Bookmark This Page library-bookmarks-bookmark-edit = .label = Edit This Bookmark +library-recent-activity-label = Recent Activity ## More items diff --git a/browser/locales/en-US/browser/newtab/newtab.ftl b/browser/locales/en-US/browser/newtab/newtab.ftl index 97880fe5ea16..350f24a7271c 100644 --- a/browser/locales/en-US/browser/newtab/newtab.ftl +++ b/browser/locales/en-US/browser/newtab/newtab.ftl @@ -33,7 +33,9 @@ newtab-search-box-input = newtab-topsites-add-search-engine-header = Add Search Engine newtab-topsites-add-topsites-header = New Top Site +newtab-topsites-add-shortcut-header = New Shortcut newtab-topsites-edit-topsites-header = Edit Top Site +newtab-topsites-edit-shortcut-header = Edit Shortcut newtab-topsites-title-label = Title newtab-topsites-title-input = .placeholder = Enter a title diff --git a/browser/locales/en-US/browser/preferences/preferences.ftl b/browser/locales/en-US/browser/preferences/preferences.ftl index d90823fa6b38..bbf8ae9878b0 100644 --- a/browser/locales/en-US/browser/preferences/preferences.ftl +++ b/browser/locales/en-US/browser/preferences/preferences.ftl @@ -1112,6 +1112,10 @@ addressbar-locbar-bookmarks-option = addressbar-locbar-openpage-option = .label = Open tabs .accesskey = O +# Shortcuts refers to the shortcut tiles on the new tab page, previously known as top sites. Translation should be consistent. +addressbar-locbar-shortcuts-option = + .label = Shortcuts + .accesskey = S addressbar-locbar-topsites-option = .label = Top sites .accesskey = T