Ignore common places for tests from makemessages

This also replaces some of the existing tweaks, which avoided strings
getting parsed by makemessages.
pull/7581/head
Stefan Hammer 2022-05-13 11:06:55 +02:00 zatwierdzone przez LB (Ben Johnston)
rodzic 2abe439064
commit 46977d6442
6 zmienionych plików z 24 dodań i 22 usunięć

Wyświetl plik

@ -46,6 +46,7 @@ Changelog
* Fix: Add an accessible label to the image focal point input when editing images (Lucie Le Frapper)
* Fix: Remove unused header search JavaScript on the redirects import page (LB (Ben) Johnston)
* FIx: Ensure non-square avatar images will correctly show throughout the admin (LB (Ben) Johnston)
* Fix: Ignore translations in test files and re-include some translations that were accidentally ignored (Stefan Hammer)
3.0 (16.05.2022)

Wyświetl plik

@ -60,6 +60,7 @@ When using a queryset to render a list of images, you can now use the ``prefetch
* Add an accessible label to the image focal point input when editing images (Lucie Le Frapper)
* Remove unused header search JavaScript on the redirects import page (LB (Ben) Johnston)
* Ensure non-square avatar images will correctly show throughout the admin (LB (Ben) Johnston)
* Ignore translations in test files and re-include some translations that were accidentally ignored (Stefan Hammer)
## Upgrade considerations

Wyświetl plik

@ -5,7 +5,7 @@ find ../wagtail -iname *.po -iwholename */en/* -delete
for d in $(find ../wagtail -iwholename */locale/* | sed 's|\(.*\)/locale.*|\1|' | sort -u);
do
pushd $d
django-admin makemessages --locale=en
django-admin makemessages --locale=en --ignore=test/* --ignore=tests/* --ignore=tests.py
popd
done

Wyświetl plik

@ -2,7 +2,7 @@ from django import forms
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.utils.functional import cached_property
from django.utils.translation import gettext as _
from django.utils.translation import gettext_lazy as __
from django.utils.translation import gettext_lazy
from wagtail.admin import widgets
from wagtail.admin.forms import WagtailAdminModelForm
@ -14,7 +14,7 @@ from wagtail.models import Page, Task, Workflow, WorkflowPage
class TaskChooserSearchForm(forms.Form):
q = forms.CharField(
label=__("Search term"), widget=forms.TextInput(), required=False
label=gettext_lazy("Search term"), widget=forms.TextInput(), required=False
)
def __init__(self, *args, task_type_choices=None, **kwargs):

Wyświetl plik

@ -11,7 +11,7 @@ from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
from django.db import models
from django.shortcuts import redirect
from django.template.response import TemplateResponse
from django.utils.functional import lazystr
from django.utils.translation import gettext_lazy as _
from modelcluster.contrib.taggit import ClusterTaggableManager
from modelcluster.fields import ParentalKey, ParentalManyToManyField
from modelcluster.models import ClusterableModel
@ -998,7 +998,7 @@ class BusinessChild(Page):
subpage_types = []
parent_page_types = ["tests.BusinessIndex", BusinessSubIndex]
page_description = lazystr("A lazy business child page description")
page_description = _("A lazy business child page description")
class BusinessNowherePage(Page):

Wyświetl plik

@ -12,7 +12,7 @@ from django.forms.utils import ErrorList
from django.template.loader import render_to_string
from django.test import SimpleTestCase, TestCase
from django.utils.safestring import SafeData, mark_safe
from django.utils.translation import gettext_lazy as __
from django.utils.translation import gettext_lazy as _
from wagtail import blocks
from wagtail.blocks.field_block import FieldBlockAdapter
@ -926,8 +926,8 @@ class TestChoiceBlock(WagtailTestUtils, SimpleTestCase):
def test_searchable_content_with_lazy_translation(self):
block = blocks.ChoiceBlock(
choices=[
("choice-1", __("Choice 1")),
("choice-2", __("Choice 2")),
("choice-1", _("Choice 1")),
("choice-2", _("Choice 2")),
]
)
result = block.get_searchable_content("choice-1")
@ -940,17 +940,17 @@ class TestChoiceBlock(WagtailTestUtils, SimpleTestCase):
block = blocks.ChoiceBlock(
choices=[
(
__("Section 1"),
_("Section 1"),
[
("1-1", __("Block 1")),
("1-2", __("Block 2")),
("1-1", _("Block 1")),
("1-2", _("Block 2")),
],
),
(
__("Section 2"),
_("Section 2"),
[
("2-1", __("Block 1")),
("2-2", __("Block 2")),
("2-1", _("Block 1")),
("2-2", _("Block 2")),
],
),
]
@ -1303,8 +1303,8 @@ class TestMultipleChoiceBlock(WagtailTestUtils, SimpleTestCase):
def test_searchable_content_with_lazy_translation(self):
block = blocks.MultipleChoiceBlock(
choices=[
("choice-1", __("Choice 1")),
("choice-2", __("Choice 2")),
("choice-1", _("Choice 1")),
("choice-2", _("Choice 2")),
]
)
result = block.get_searchable_content("choice-1")
@ -1317,17 +1317,17 @@ class TestMultipleChoiceBlock(WagtailTestUtils, SimpleTestCase):
block = blocks.MultipleChoiceBlock(
choices=[
(
__("Section 1"),
_("Section 1"),
[
("1-1", __("Block 1")),
("1-2", __("Block 2")),
("1-1", _("Block 1")),
("1-2", _("Block 2")),
],
),
(
__("Section 2"),
_("Section 2"),
[
("2-1", __("Block 1")),
("2-2", __("Block 2")),
("2-1", _("Block 1")),
("2-2", _("Block 2")),
],
),
]