Opened 3 weeks ago

Closed 3 weeks ago

#37269 closed Uncategorized (worksforme)

BLANK_CHOICE_LABEL is not translated

Reported by: alex Owned by:
Component: Internationalization Version: 6.1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Problem

Despite defined in the po file BLANK_CHOICE_LABEL is not translated in the changelist action menu. I suspect a too early str() call.

Change History (1)

comment:1 by Sarah Boyce, 3 weeks ago

Resolution: worksforme
Status: newclosed

Hi Alex, I can't replicate via testing (the below test passes once I add the translation file)

  • tests/admin_views/test_actions.py

    a b from django.template.response import TemplateResponse  
    1212from django.test import TestCase, override_settings
    1313from django.test.utils import CaptureQueriesContext
    1414from django.urls import reverse
     15from django.utils import translation
    1516from django.utils.deprecation import RemovedInDjango70Warning
    1617
    1718from .admin import SubscriberAdmin
    class AdminActionsTest(TestCase):  
    514515        self.assertIn(r""new_value\\"", output)
    515516        self.assertIn(r""obj\\"", output)
    516517
     518    def test_action_blank_choice_label_is_translated(self):
     519        with translation.override("de"):
     520            response = self.client.get(
     521                reverse("admin:admin_views_subscriber_changelist")
     522            )
     523
     524        self.assertContains(response, "- Wähle eine Option -")
     525

Can you explain how to replicate? Perhaps the translation you are after hasn't been translated yet?

Note: See TracTickets for help on using tickets.
Back to Top