Add region setting to supplement localization (#1875)

This commit is contained in:
Raphael Michel
2020-12-14 13:15:38 +01:00
committed by GitHub
parent e311341d01
commit 04bfa63a5e
46 changed files with 281 additions and 90 deletions

View File

@@ -144,7 +144,7 @@ def render_pdf(event, positions, opt):
offsetx = opt['margins'][3] + (i % opt['cols']) * opt['offsets'][0]
offsety = opt['margins'][2] + (opt['rows'] - 1 - i // opt['cols']) * opt['offsets'][1]
p.translate(offsetx, offsety)
with language(op.order.locale):
with language(op.order.locale, op.order.event.settings.region):
r.draw_page(p, op.order, op, show_page=False)
p.translate(-offsetx, -offsety)

View File

@@ -26,7 +26,7 @@ logger = logging.getLogger(__name__)
def notify_incomplete_payment(o: Order):
with language(o.locale):
with language(o.locale, o.event.settings.region):
email_template = o.event.settings.mail_text_order_expire_warning
email_context = get_email_context(event=o.event, order=o)
email_subject = gettext('Your order received an incomplete payment: %(code)s') % {'code': o.code}

View File

@@ -52,7 +52,7 @@ def send_mails(event: Event, user: int, subject: dict, message: dict, orders: li
continue
try:
with language(o.locale):
with language(o.locale, event.settings.region):
email_context = get_email_context(event=event, order=o, position_or_address=p, position=p)
mail(
p.attendee_email,
@@ -80,7 +80,7 @@ def send_mails(event: Event, user: int, subject: dict, message: dict, orders: li
if send_to_order and o.email:
try:
with language(o.locale):
with language(o.locale, event.settings.region):
email_context = get_email_context(event=event, order=o, position_or_address=ia)
mail(
o.email,

View File

@@ -127,7 +127,7 @@ class SenderView(EventPermissionRequiredMixin, FormView):
if self.request.POST.get("action") == "preview":
for l in self.request.event.settings.locales:
with language(l):
with language(l, self.request.event.settings.region):
context_dict = TolerantDict()
for k, v in get_available_placeholders(self.request.event, ['event', 'order',
'position_or_address']).items():

View File

@@ -82,7 +82,7 @@ class AllTicketsPDF(BaseExporter):
if op.order.event != o.event:
o = PdfTicketOutput(op.event)
with language(op.order.locale):
with language(op.order.locale, o.event.settings.region):
layout = o.layout_map.get(
(op.item_id, op.order.sales_channel),
o.layout_map.get(

View File

@@ -79,7 +79,7 @@ class PdfTicketOutput(BaseTicketOutput):
def generate_order(self, order: Order):
merger = PdfFileMerger()
with language(order.locale):
with language(order.locale, self.event.settings.region):
for op in order.positions_with_tickets:
layout = override_layout.send_chained(
order.event, 'layout', orderposition=op, layout=self.layout_map.get(
@@ -111,7 +111,7 @@ class PdfTicketOutput(BaseTicketOutput):
)
)
)
with language(order.locale):
with language(order.locale, self.event.settings.region):
outbuffer = self._draw_page(layout, op, order)
return 'order%s%s.pdf' % (self.event.slug, order.code), 'application/pdf', outbuffer.read()