mirror of
https://github.com/pretix/pretix.git
synced 2026-05-10 16:04:02 +00:00
Localize salutation when creating PDFs (#2631)
This commit is contained in:
committed by
GitHub
parent
37230dd657
commit
2124161744
@@ -55,7 +55,7 @@ from django.utils.formats import date_format
|
|||||||
from django.utils.functional import SimpleLazyObject
|
from django.utils.functional import SimpleLazyObject
|
||||||
from django.utils.html import conditional_escape
|
from django.utils.html import conditional_escape
|
||||||
from django.utils.timezone import now
|
from django.utils.timezone import now
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _, pgettext
|
||||||
from i18nfield.strings import LazyI18nString
|
from i18nfield.strings import LazyI18nString
|
||||||
from PyPDF2 import PdfFileReader
|
from PyPDF2 import PdfFileReader
|
||||||
from pytz import timezone
|
from pytz import timezone
|
||||||
@@ -521,8 +521,12 @@ def variables_from_questions(sender, *args, **kwargs):
|
|||||||
|
|
||||||
def _get_attendee_name_part(key, op, order, ev):
|
def _get_attendee_name_part(key, op, order, ev):
|
||||||
if isinstance(key, tuple):
|
if isinstance(key, tuple):
|
||||||
return ' '.join(p for p in [_get_attendee_name_part(c[0], op, order, ev) for c in key] if p)
|
parts = [_get_attendee_name_part(c[0], op, order, ev) for c in key if not (c[0] == 'salutation' and op.attendee_name_parts.get(c[0], '') == "Mx")]
|
||||||
return op.attendee_name_parts.get(key, '')
|
return ' '.join(p for p in parts if p)
|
||||||
|
value = op.attendee_name_parts.get(key, '')
|
||||||
|
if key == 'salutation':
|
||||||
|
return pgettext('person_name_salutation', value)
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
def _get_ia_name_part(key, op, order, ev):
|
def _get_ia_name_part(key, op, order, ev):
|
||||||
|
|||||||
Reference in New Issue
Block a user