From f51906338fc566d3a72a9a28e14e68f3a2521740 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Tue, 24 Jun 2025 16:14:33 +0200 Subject: [PATCH] Order detail: Set correct language for invoice email (Z#23197863) (#5260) --- src/pretix/control/views/orders.py | 35 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/src/pretix/control/views/orders.py b/src/pretix/control/views/orders.py index cca5fef1f4..e1658b7873 100644 --- a/src/pretix/control/views/orders.py +++ b/src/pretix/control/views/orders.py @@ -548,23 +548,24 @@ class OrderDetail(OrderView): unsent_invoices = [ii.pk for ii in ctx['invoices'] if not ii.sent_to_customer] if unsent_invoices: - ctx['invoices_send_link'] = reverse('control:event.order.sendmail', kwargs={ - 'event': self.request.event.slug, - 'organizer': self.request.event.organizer.slug, - 'code': self.order.code - }) + '?' + urlencode({ - 'subject': ngettext('Your invoice', 'Your invoices', len(unsent_invoices)), - 'message': ngettext( - 'Hello,\n\nplease find your invoice attached to this email.\n\n' - 'Your {event} team', - 'Hello,\n\nplease find your invoices attached to this email.\n\n' - 'Your {event} team', - len(unsent_invoices) - ).format( - event="{event}", - ), - 'attach_invoices': unsent_invoices - }, doseq=True) + with language(self.order.locale): + ctx['invoices_send_link'] = reverse('control:event.order.sendmail', kwargs={ + 'event': self.request.event.slug, + 'organizer': self.request.event.organizer.slug, + 'code': self.order.code + }) + '?' + urlencode({ + 'subject': ngettext('Your invoice', 'Your invoices', len(unsent_invoices)), + 'message': ngettext( + 'Hello,\n\nplease find your invoice attached to this email.\n\n' + 'Your {event} team', + 'Hello,\n\nplease find your invoices attached to this email.\n\n' + 'Your {event} team', + len(unsent_invoices) + ).format( + event="{event}", + ), + 'attach_invoices': unsent_invoices + }, doseq=True) return ctx