From 8812da5325fa70acdf447def296f48c46628fdb1 Mon Sep 17 00:00:00 2001 From: Raphael Michel Date: Tue, 15 Mar 2016 17:09:04 +0100 Subject: [PATCH] Fixed a wrong locale string --- src/pretix/base/i18n.py | 5 ++++- src/pretix/base/services/mail.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/pretix/base/i18n.py b/src/pretix/base/i18n.py index 2c7bf8123..f509204f1 100644 --- a/src/pretix/base/i18n.py +++ b/src/pretix/base/i18n.py @@ -37,10 +37,13 @@ class LazyI18nString: This will rather return you a string in a wrong language than give you an empty value. """ + return self.localize(translation.get_language()) + + def localize(self, lng): if self.data is None: return "" + if isinstance(self.data, dict): - lng = translation.get_language() firstpart = lng.split('-')[0] similar = [l for l in self.data.keys() if l.startswith(firstpart + "-")] if lng in self.data and self.data[lng]: diff --git a/src/pretix/base/services/mail.py b/src/pretix/base/services/mail.py index de6c46cd5..e6a35c52a 100644 --- a/src/pretix/base/services/mail.py +++ b/src/pretix/base/services/mail.py @@ -61,8 +61,8 @@ def mail(email: str, subject: str, template: str, body += "\r\n\r\n----\r\n" body += _( - "You are receiving this e-mail because you placed an order for %s." % event.name - ) + "You are receiving this e-mail because you placed an order for {event}." + ).format(event=event.name) body += "\r\n" try: return mail_send([email], subject, body, sender, event.id if event else None)