From cafc2130afecc92c419ad3f5bb6d7e66cb0a91e8 Mon Sep 17 00:00:00 2001 From: Florian Vogt Date: Fri, 4 Nov 2022 15:14:21 +0100 Subject: [PATCH] Use blocktrans to remove trailing whitespace in headers - Fixes #9596 --- CHANGELOG.txt | 1 + CONTRIBUTORS.rst | 1 + docs/releases/4.2.md | 1 + .../wagtailadmin/shared/headers/page_create_header.html | 2 +- .../wagtailsnippets/snippets/headers/create_header.html | 2 +- 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index d2104c9fd9..480655a95b 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -35,6 +35,7 @@ Changelog * Fix: Ensure tag fields correctly show in both dark and light Windows high-contrast modes (Albina Starykova) * Fix: Ensure new tooltips & tooltip menus have visible borders and tip triangle in Windows high-contrast mode (Juliet Adeboye) * Fix: Ensure there is a visual difference of 'active/current link' vs normal links in Windows high-contrast mode (Mohammad Areeb) + * Fix: Avoid issues where trailing whitespace could be accidentally removed in translations for new page & snippet headers (Florian Vogt) 4.1.1 (xx.xx.xxxx) - IN DEVELOPMENT diff --git a/CONTRIBUTORS.rst b/CONTRIBUTORS.rst index 4061bbb09b..3431a4f1a1 100644 --- a/CONTRIBUTORS.rst +++ b/CONTRIBUTORS.rst @@ -663,6 +663,7 @@ Contributors * Aman Pandey * Doug Harris * Mohammad Areeb +* Florian Vogt Translators =========== diff --git a/docs/releases/4.2.md b/docs/releases/4.2.md index 48063654e0..10832bc962 100644 --- a/docs/releases/4.2.md +++ b/docs/releases/4.2.md @@ -46,6 +46,7 @@ depth: 1 * Ensure tag fields correctly show in both dark and light Windows high-contrast modes (Albina Starykova) * Ensure new tooltips & tooltip menus have visible borders and tip triangle in Windows high-contrast mode (Juliet Adeboye) * Ensure there is a visual difference of 'active/current link' vs normal links in Windows high-contrast mode (Mohammad Areeb) + * Avoid issues where trailing whitespace could be accidentally removed in translations for new page & snippet headers (Florian Vogt) ## Upgrade considerations diff --git a/wagtail/admin/templates/wagtailadmin/shared/headers/page_create_header.html b/wagtail/admin/templates/wagtailadmin/shared/headers/page_create_header.html index b979afbbb6..dcf25bb07e 100644 --- a/wagtail/admin/templates/wagtailadmin/shared/headers/page_create_header.html +++ b/wagtail/admin/templates/wagtailadmin/shared/headers/page_create_header.html @@ -2,7 +2,7 @@ {% load wagtailadmin_tags i18n %} {% block header_content %} - {% trans 'New: '|add:content_type.model_class.get_verbose_name as title %} + {% blocktrans trimmed asvar title with model_name=content_type.model_class.get_verbose_name %}New: {{ model_name }}{% endblocktrans %} {% breadcrumbs parent_page 'wagtailadmin_explore' url_root_name='wagtailadmin_explore_root' include_self=True trailing_breadcrumb_title=title %}

diff --git a/wagtail/snippets/templates/wagtailsnippets/snippets/headers/create_header.html b/wagtail/snippets/templates/wagtailsnippets/snippets/headers/create_header.html index 0fab72545d..2e7220f05c 100644 --- a/wagtail/snippets/templates/wagtailsnippets/snippets/headers/create_header.html +++ b/wagtail/snippets/templates/wagtailsnippets/snippets/headers/create_header.html @@ -12,7 +12,7 @@ {% block header_content %} {% with model_opts.verbose_name|capfirst as model_name %} - {% trans 'New: '|add:model_name as title %} + {% blocktrans trimmed asvar title %}New: {{ model_name }}{% endblocktrans %} {{ block.super }}