From 148629c9675d4dfac978f69024da9fedaa929c2f Mon Sep 17 00:00:00 2001 From: maureenlholland Date: Tue, 21 Jan 2025 11:03:19 -0500 Subject: [PATCH 1/4] Add shortcuts WNP135 (#15852) --- .../firefox/whatsnew/whatsnew-fx135.html | 63 +++++++++++ bedrock/firefox/views.py | 3 + l10n/configs/pontoon.toml | 102 ++++++++++++++++++ .../firefox/whatsnew/whatsnew-shortcuts.ftl | 10 ++ media/css/firefox/whatsnew/whatsnew-135.scss | 25 +++++ .../img/l10n/de/firefox/wnp-135/shortcuts.svg | 1 + .../l10n/en-US/firefox/wnp-135/shortcuts.svg | 1 + media/static-bundles.json | 6 ++ 8 files changed, 211 insertions(+) create mode 100644 bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx135.html create mode 100644 l10n/en/firefox/whatsnew/whatsnew-shortcuts.ftl create mode 100644 media/css/firefox/whatsnew/whatsnew-135.scss create mode 100644 media/img/l10n/de/firefox/wnp-135/shortcuts.svg create mode 100644 media/img/l10n/en-US/firefox/wnp-135/shortcuts.svg diff --git a/bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx135.html b/bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx135.html new file mode 100644 index 00000000000..69734d086fe --- /dev/null +++ b/bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx135.html @@ -0,0 +1,63 @@ +{# + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at https://mozilla.org/MPL/2.0/. +#} + +{% extends "firefox/whatsnew/base.html" %} + +{% block page_css %} + {{ css_bundle('firefox_whatsnew_135') }} +{% endblock %} + +{% set utm_params = 'utm_source=www.mozilla.org&utm_medium=referral&utm_campaign=wnp135-shortcuts' %} + +{% if LANG == 'de' %} + {% set main_title = 'Ein Zoom auf die Funktionen von Firefox' %} + {% set main_tagline = 'Navigiere dich mit Firefox schnell durchs Web und nutze cmd/Strg + und cmd/Strg -, um unkompliziert Inhalte zu vergrößern oder zu verkleinern.' %} + {% set main_cta = 'Entdecke weitere Tastenkombinationen' %} +{% elif LANG == 'fr' %} + {% set main_title = 'Zoomez sur les fonctionnalités de Firefox' %} + {% set main_tagline = 'Naviguez sur Firefox rapidement avec cmd/ctrl + et cmd/ctrl - pour facilement redimensionner le contenu d’une page web.' %} + {% set main_cta = 'Découvrir plus de raccourcis' %} +{% elif LANG.startswith('en-') %} + {% set main_title = 'Zoom in to Firefox functions' %} + {% set main_tagline = 'Navigate Firefox quickly and use cmd/ctrl + and cmd/ctrl - to easily resize content, making it larger or smaller.' %} + {% set main_cta = 'Find more shortcuts' %} +{% endif %} + +{% set main_cta_link = 'https://support.mozilla.org/kb/keyboard-shortcuts-perform-firefox-tasks-quickly?' + utm_params %} + +{% block wnp_content %} +
+
+ +

+ {% if main_title %} + {{ main_title }} + {% else %} + {{ ftl('whatsnew-shortcuts-title')}} + {% endif %} +

+

+ {% if main_tagline %} + {{ main_tagline | safe }} + {% else %} + {{ ftl('whatsnew-shortcuts-tagline')}} + {% endif %} +

+ + {% if main_cta %} + {{ main_cta }} + {% else %} + {{ ftl('whatsnew-shortcuts-cta')}} + {% endif %} + +
+
+ + +{% endblock %} diff --git a/bedrock/firefox/views.py b/bedrock/firefox/views.py index b6d6ebf664f..fd203b0cec3 100644 --- a/bedrock/firefox/views.py +++ b/bedrock/firefox/views.py @@ -505,6 +505,7 @@ class WhatsnewView(L10nTemplateView): "firefox/whatsnew/whatsnew-fx134-gb.html": ["firefox/whatsnew/whatsnew"], "firefox/whatsnew/whatsnew-fx134-de.html": ["firefox/whatsnew/whatsnew"], "firefox/whatsnew/whatsnew-fx134-fr.html": ["firefox/whatsnew/whatsnew"], + "firefox/whatsnew/whatsnew-fx135.html": ["firefox/whatsnew/whatsnew-shortcuts", "firefox/whatsnew/whatsnew"], } # specific templates that should not be rendered in @@ -616,6 +617,8 @@ def get_template_names(self): template = "firefox/whatsnew/index.html" else: template = "firefox/whatsnew/index.html" + elif version.startswith("135."): + template = "firefox/whatsnew/whatsnew-fx135.html" elif version.startswith("134."): if locale == "en-US": template = "firefox/whatsnew/whatsnew-fx134-us.html" diff --git a/l10n/configs/pontoon.toml b/l10n/configs/pontoon.toml index 1bcb6690a06..9f9da7c1cf5 100644 --- a/l10n/configs/pontoon.toml +++ b/l10n/configs/pontoon.toml @@ -369,3 +369,105 @@ locales = [ [[paths]] reference = "en/products/vpn/features.ftl" l10n = "{locale}/products/vpn/features.ftl" +[[paths]] + reference = "en/firefox/whatsnew/whatsnew-shortcuts.ftl" + l10n = "{locale}/firefox/whatsnew/whatsnew-shortcuts.ftl" + locales = [ + "ach", + "af", + "am", + "an", + "ast", + "az", + "azz", + "be", + "bg", + "bn", + "br", + "bs", + "ca", + "cak", + "crh", + "cs", + "cy", + "da", + "dsb", + "el", + "eo", + "es-AR", + "es-CL", + "es-ES", + "es-MX", + "et", + "eu", + "fa", + "ff", + "fi", + "fy-NL", + "ga-IE", + "gd", + "gl", + "gn", + "gu-IN", + "he", + "hr", + "hsb", + "hu", + "hy-AM", + "ia", + "is", + "it", + "ka", + "kab", + "kk", + "km", + "kn", + "ko", + "lij", + "lo", + "lt", + "ltg", + "lv", + "mk", + "ml", + "mr", + "my", + "nb-NO", + "ne-NP", + "nl", + "nn-NO", + "oc", + "pa-IN", + "pl", + "pt-BR", + "pt-PT", + "rm", + "ro", + "ru", + "sco", + "scn", + "si", + "sk", + "skr", + "sl", + "son", + "sq", + "sr", + "sv-SE", + "ta", + "te", + "tg", + "th", + "tl", + "tr", + "trs", + "uk", + "ur", + "uz", + "vi", + "wo", + "xh", + "zam", + "zh-CN", + "zh-TW", + ] diff --git a/l10n/en/firefox/whatsnew/whatsnew-shortcuts.ftl b/l10n/en/firefox/whatsnew/whatsnew-shortcuts.ftl new file mode 100644 index 00000000000..d9b359cc494 --- /dev/null +++ b/l10n/en/firefox/whatsnew/whatsnew-shortcuts.ftl @@ -0,0 +1,10 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at https://mozilla.org/MPL/2.0/. + +### URL: https://www-dev.allizom.org/firefox/135.0/whatsnew/ + +whatsnew-shortcuts-title = Zoom in to { -brand-name-firefox } functions +# "cmd/ctrl +" and "cmd/ctrl -" are keyboard commands to zoom browser view in or out +whatsnew-shortcuts-tagline = Navigate { -brand-name-firefox } quickly and use cmd/ctrl + and cmd/ctrl - to easily resize content, making it larger or smaller. +whatsnew-shortcuts-cta = Find more shortcuts diff --git a/media/css/firefox/whatsnew/whatsnew-135.scss b/media/css/firefox/whatsnew/whatsnew-135.scss new file mode 100644 index 00000000000..371a9698b5e --- /dev/null +++ b/media/css/firefox/whatsnew/whatsnew-135.scss @@ -0,0 +1,25 @@ +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this +// file, You can obtain one at https://mozilla.org/MPL/2.0/. + +@import 'includes/base'; +@import '~@mozilla-protocol/core/protocol/css/includes/lib'; +@import '~@mozilla-protocol/core/protocol/css/components/notification-bar'; +@import 'includes/dark-mode'; +@import 'includes/mofo-donate-cta'; + +.mzp-l-content.mzp-t-content-sm { + max-width: 450px; // protocol is 432px, we need slightly bigger +} + +.wnp-content-main { + text-align: center; +} + +.wnp-main-title { + line-height: 1.01; +} + +.wnp-main-image { + margin-bottom: $spacing-lg; +} diff --git a/media/img/l10n/de/firefox/wnp-135/shortcuts.svg b/media/img/l10n/de/firefox/wnp-135/shortcuts.svg new file mode 100644 index 00000000000..06c1aa23f4e --- /dev/null +++ b/media/img/l10n/de/firefox/wnp-135/shortcuts.svg @@ -0,0 +1 @@ + diff --git a/media/img/l10n/en-US/firefox/wnp-135/shortcuts.svg b/media/img/l10n/en-US/firefox/wnp-135/shortcuts.svg new file mode 100644 index 00000000000..23b957e004b --- /dev/null +++ b/media/img/l10n/en-US/firefox/wnp-135/shortcuts.svg @@ -0,0 +1 @@ + diff --git a/media/static-bundles.json b/media/static-bundles.json index 863e8488944..f03a0341de6 100644 --- a/media/static-bundles.json +++ b/media/static-bundles.json @@ -441,6 +441,12 @@ ], "name": "firefox_whatsnew_135beta" }, + { + "files": [ + "css/firefox/whatsnew/whatsnew-135.scss" + ], + "name": "firefox_whatsnew_135" + }, { "files": [ "css/firefox/firefox-20th/firefox-20th.scss" From 38872ffec79b377f5b00f4a37512fc2893268155 Mon Sep 17 00:00:00 2001 From: maureenlholland Date: Tue, 21 Jan 2025 13:46:31 -0500 Subject: [PATCH 2/4] Remove pontoon config It's not typical for our WNP templates to include special FTL files. The only exceptions are an MDN-focused one and s2d (evergreen default). Removing this all locale logic for now until it's confirmed we want to go ahead with this many pontoon translations. --- .../firefox/whatsnew/whatsnew-fx135.html | 26 +---- bedrock/firefox/views.py | 2 +- l10n/configs/pontoon.toml | 102 ------------------ .../firefox/whatsnew/whatsnew-shortcuts.ftl | 10 -- 4 files changed, 5 insertions(+), 135 deletions(-) delete mode 100644 l10n/en/firefox/whatsnew/whatsnew-shortcuts.ftl diff --git a/bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx135.html b/bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx135.html index 69734d086fe..c1543dfd7fe 100644 --- a/bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx135.html +++ b/bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx135.html @@ -20,7 +20,7 @@ {% set main_title = 'Zoomez sur les fonctionnalités de Firefox' %} {% set main_tagline = 'Naviguez sur Firefox rapidement avec cmd/ctrl + et cmd/ctrl - pour facilement redimensionner le contenu d’une page web.' %} {% set main_cta = 'Découvrir plus de raccourcis' %} -{% elif LANG.startswith('en-') %} +{% else %} {% set main_title = 'Zoom in to Firefox functions' %} {% set main_tagline = 'Navigate Firefox quickly and use cmd/ctrl + and cmd/ctrl - to easily resize content, making it larger or smaller.' %} {% set main_cta = 'Find more shortcuts' %} @@ -32,27 +32,9 @@
-

- {% if main_title %} - {{ main_title }} - {% else %} - {{ ftl('whatsnew-shortcuts-title')}} - {% endif %} -

-

- {% if main_tagline %} - {{ main_tagline | safe }} - {% else %} - {{ ftl('whatsnew-shortcuts-tagline')}} - {% endif %} -

- - {% if main_cta %} - {{ main_cta }} - {% else %} - {{ ftl('whatsnew-shortcuts-cta')}} - {% endif %} - +

{{ main_title }}

+

{{ main_tagline | safe }}

+ {{ main_cta }}
diff --git a/bedrock/firefox/views.py b/bedrock/firefox/views.py index fd203b0cec3..fb7f117a62e 100644 --- a/bedrock/firefox/views.py +++ b/bedrock/firefox/views.py @@ -505,7 +505,7 @@ class WhatsnewView(L10nTemplateView): "firefox/whatsnew/whatsnew-fx134-gb.html": ["firefox/whatsnew/whatsnew"], "firefox/whatsnew/whatsnew-fx134-de.html": ["firefox/whatsnew/whatsnew"], "firefox/whatsnew/whatsnew-fx134-fr.html": ["firefox/whatsnew/whatsnew"], - "firefox/whatsnew/whatsnew-fx135.html": ["firefox/whatsnew/whatsnew-shortcuts", "firefox/whatsnew/whatsnew"], + "firefox/whatsnew/whatsnew-fx135.html": ["firefox/whatsnew/whatsnew"], } # specific templates that should not be rendered in diff --git a/l10n/configs/pontoon.toml b/l10n/configs/pontoon.toml index 9f9da7c1cf5..1bcb6690a06 100644 --- a/l10n/configs/pontoon.toml +++ b/l10n/configs/pontoon.toml @@ -369,105 +369,3 @@ locales = [ [[paths]] reference = "en/products/vpn/features.ftl" l10n = "{locale}/products/vpn/features.ftl" -[[paths]] - reference = "en/firefox/whatsnew/whatsnew-shortcuts.ftl" - l10n = "{locale}/firefox/whatsnew/whatsnew-shortcuts.ftl" - locales = [ - "ach", - "af", - "am", - "an", - "ast", - "az", - "azz", - "be", - "bg", - "bn", - "br", - "bs", - "ca", - "cak", - "crh", - "cs", - "cy", - "da", - "dsb", - "el", - "eo", - "es-AR", - "es-CL", - "es-ES", - "es-MX", - "et", - "eu", - "fa", - "ff", - "fi", - "fy-NL", - "ga-IE", - "gd", - "gl", - "gn", - "gu-IN", - "he", - "hr", - "hsb", - "hu", - "hy-AM", - "ia", - "is", - "it", - "ka", - "kab", - "kk", - "km", - "kn", - "ko", - "lij", - "lo", - "lt", - "ltg", - "lv", - "mk", - "ml", - "mr", - "my", - "nb-NO", - "ne-NP", - "nl", - "nn-NO", - "oc", - "pa-IN", - "pl", - "pt-BR", - "pt-PT", - "rm", - "ro", - "ru", - "sco", - "scn", - "si", - "sk", - "skr", - "sl", - "son", - "sq", - "sr", - "sv-SE", - "ta", - "te", - "tg", - "th", - "tl", - "tr", - "trs", - "uk", - "ur", - "uz", - "vi", - "wo", - "xh", - "zam", - "zh-CN", - "zh-TW", - ] diff --git a/l10n/en/firefox/whatsnew/whatsnew-shortcuts.ftl b/l10n/en/firefox/whatsnew/whatsnew-shortcuts.ftl deleted file mode 100644 index d9b359cc494..00000000000 --- a/l10n/en/firefox/whatsnew/whatsnew-shortcuts.ftl +++ /dev/null @@ -1,10 +0,0 @@ -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at https://mozilla.org/MPL/2.0/. - -### URL: https://www-dev.allizom.org/firefox/135.0/whatsnew/ - -whatsnew-shortcuts-title = Zoom in to { -brand-name-firefox } functions -# "cmd/ctrl +" and "cmd/ctrl -" are keyboard commands to zoom browser view in or out -whatsnew-shortcuts-tagline = Navigate { -brand-name-firefox } quickly and use cmd/ctrl + and cmd/ctrl - to easily resize content, making it larger or smaller. -whatsnew-shortcuts-cta = Find more shortcuts From e7c0808e681bcfffe431dad1c3ac630ef4385a06 Mon Sep 17 00:00:00 2001 From: maureenlholland Date: Tue, 21 Jan 2025 16:08:11 -0500 Subject: [PATCH 3/4] Add view logic and tests --- ...snew-fx135.html => whatsnew-fx135-eu.html} | 0 bedrock/firefox/tests/test_base.py | 49 +++++++++++++++++++ bedrock/firefox/views.py | 7 ++- 3 files changed, 54 insertions(+), 2 deletions(-) rename bedrock/firefox/templates/firefox/whatsnew/{whatsnew-fx135.html => whatsnew-fx135-eu.html} (100%) diff --git a/bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx135.html b/bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx135-eu.html similarity index 100% rename from bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx135.html rename to bedrock/firefox/templates/firefox/whatsnew/whatsnew-fx135-eu.html diff --git a/bedrock/firefox/tests/test_base.py b/bedrock/firefox/tests/test_base.py index 77160917ab0..73c020cacf1 100644 --- a/bedrock/firefox/tests/test_base.py +++ b/bedrock/firefox/tests/test_base.py @@ -1164,6 +1164,55 @@ def test_fx_134_0_0_es_es(self, render_mock): # end 134.0 whatsnew tests + # begin 135.0 whatsnew tests + + @override_settings(DEV=True) + def test_fx_135_0_0_fr(self, render_mock): + """Should use whatsnew-fx135-eu.html template for fr locale""" + req = self.rf.get("/firefox/whatsnew/") + req.locale = "fr" + self.view(req, version="135.0") + template = render_mock.call_args[0][1] + assert template == ["firefox/whatsnew/whatsnew-fx135-eu.html"] + + @override_settings(DEV=True) + def test_fx_135_0_0_de(self, render_mock): + """Should use whatsnew-fx135-eu.html template for de locale""" + req = self.rf.get("/firefox/whatsnew/") + req.locale = "de" + self.view(req, version="135.0") + template = render_mock.call_args[0][1] + assert template == ["firefox/whatsnew/whatsnew-fx135-eu.html"] + + @override_settings(DEV=True) + def test_fx_135_0_0_en_gb(self, render_mock): + """Should use whatsnew-fx135-eu.html template for en locale and country GB""" + req = self.rf.get("/firefox/whatsnew/", HTTP_CF_IPCOUNTRY="GB") + req.locale = "en-US" + self.view(req, version="135.0") + template = render_mock.call_args[0][1] + assert template == ["firefox/whatsnew/whatsnew-fx135-eu.html"] + + @override_settings(DEV=True) + def test_fx_135_0_0_non_en_gb(self, render_mock): + """Should use default WNP template for non-en locale and country GB""" + req = self.rf.get("/firefox/whatsnew/", HTTP_CF_IPCOUNTRY="GB") + req.locale = "es-ES" + self.view(req, version="135.0") + template = render_mock.call_args[0][1] + assert template == ["firefox/whatsnew/index.html"] + + @override_settings(DEV=True) + def test_fx_135_0_0_es_es(self, render_mock): + """Should use default WNP template for other locales""" + req = self.rf.get("/firefox/whatsnew/") + req.locale = "es-ES" + self.view(req, version="135.0") + template = render_mock.call_args[0][1] + assert template == ["firefox/whatsnew/index.html"] + + # end 135.0 whatsnew tests + @patch("bedrock.firefox.views.l10n_utils.render", return_value=HttpResponse()) class TestFirstRun(TestCase): diff --git a/bedrock/firefox/views.py b/bedrock/firefox/views.py index fb7f117a62e..e6812d004d9 100644 --- a/bedrock/firefox/views.py +++ b/bedrock/firefox/views.py @@ -505,7 +505,7 @@ class WhatsnewView(L10nTemplateView): "firefox/whatsnew/whatsnew-fx134-gb.html": ["firefox/whatsnew/whatsnew"], "firefox/whatsnew/whatsnew-fx134-de.html": ["firefox/whatsnew/whatsnew"], "firefox/whatsnew/whatsnew-fx134-fr.html": ["firefox/whatsnew/whatsnew"], - "firefox/whatsnew/whatsnew-fx135.html": ["firefox/whatsnew/whatsnew"], + "firefox/whatsnew/whatsnew-fx135-eu.html": ["firefox/whatsnew/whatsnew"], } # specific templates that should not be rendered in @@ -618,7 +618,10 @@ def get_template_names(self): else: template = "firefox/whatsnew/index.html" elif version.startswith("135."): - template = "firefox/whatsnew/whatsnew-fx135.html" + if locale in ["de", "fr"] or country == "GB" and locale.startswith("en-"): + template = "firefox/whatsnew/whatsnew-fx135-eu.html" + else: + template = "firefox/whatsnew/index.html" elif version.startswith("134."): if locale == "en-US": template = "firefox/whatsnew/whatsnew-fx134-us.html" From c4c23da96426d5024d0af8a842ad00f767bd057d Mon Sep 17 00:00:00 2001 From: maureenlholland Date: Wed, 22 Jan 2025 08:48:03 -0500 Subject: [PATCH 4/4] Remove geo logic and use locale logic only --- bedrock/firefox/tests/test_base.py | 15 +++------------ bedrock/firefox/views.py | 2 +- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/bedrock/firefox/tests/test_base.py b/bedrock/firefox/tests/test_base.py index 73c020cacf1..6bb9c36072d 100644 --- a/bedrock/firefox/tests/test_base.py +++ b/bedrock/firefox/tests/test_base.py @@ -1186,22 +1186,13 @@ def test_fx_135_0_0_de(self, render_mock): @override_settings(DEV=True) def test_fx_135_0_0_en_gb(self, render_mock): - """Should use whatsnew-fx135-eu.html template for en locale and country GB""" - req = self.rf.get("/firefox/whatsnew/", HTTP_CF_IPCOUNTRY="GB") - req.locale = "en-US" + """Should use whatsnew-fx135-eu.html template for en-GB locale""" + req = self.rf.get("/firefox/whatsnew/") + req.locale = "en-GB" self.view(req, version="135.0") template = render_mock.call_args[0][1] assert template == ["firefox/whatsnew/whatsnew-fx135-eu.html"] - @override_settings(DEV=True) - def test_fx_135_0_0_non_en_gb(self, render_mock): - """Should use default WNP template for non-en locale and country GB""" - req = self.rf.get("/firefox/whatsnew/", HTTP_CF_IPCOUNTRY="GB") - req.locale = "es-ES" - self.view(req, version="135.0") - template = render_mock.call_args[0][1] - assert template == ["firefox/whatsnew/index.html"] - @override_settings(DEV=True) def test_fx_135_0_0_es_es(self, render_mock): """Should use default WNP template for other locales""" diff --git a/bedrock/firefox/views.py b/bedrock/firefox/views.py index e6812d004d9..24a537a42bb 100644 --- a/bedrock/firefox/views.py +++ b/bedrock/firefox/views.py @@ -618,7 +618,7 @@ def get_template_names(self): else: template = "firefox/whatsnew/index.html" elif version.startswith("135."): - if locale in ["de", "fr"] or country == "GB" and locale.startswith("en-"): + if locale in ["de", "fr", "en-GB"]: template = "firefox/whatsnew/whatsnew-fx135-eu.html" else: template = "firefox/whatsnew/index.html"