mirror of
https://github.com/pretix/pretix.git
synced 2026-05-04 15:04:03 +00:00
Add salutation "Mx", normalize salutations (save in English, localize on display) (#2075)
* normalize salutations and localize before use * add migration to normalize salutations * add placeholder "name_for_salutation" for emails
This commit is contained in:
committed by
GitHub
parent
cf9fd47d2b
commit
8c07fa75e4
@@ -2442,10 +2442,29 @@ PERSON_NAME_TITLE_GROUPS = OrderedDict([
|
||||
])
|
||||
|
||||
PERSON_NAME_SALUTATIONS = [
|
||||
pgettext_lazy("person_name_salutation", "Ms"),
|
||||
pgettext_lazy("person_name_salutation", "Mr"),
|
||||
("Ms", pgettext_lazy("person_name_salutation", "Ms")),
|
||||
("Mr", pgettext_lazy("person_name_salutation", "Mr")),
|
||||
("Mx", pgettext_lazy("person_name_salutation", "Mx")),
|
||||
]
|
||||
|
||||
|
||||
def concatenation_for_salutation(d):
|
||||
salutation = d.get("salutation")
|
||||
title = d.get("title")
|
||||
given_name = d.get("given_name")
|
||||
family_name = d.get("family_name")
|
||||
# degree (after name) is not used in salutation
|
||||
# see https://www.schreibwerkstatt.co.at/2012/12/25/der-umgang-mit-akademischen-graden/
|
||||
|
||||
if salutation == "Mx":
|
||||
salutation = None
|
||||
elif salutation:
|
||||
salutation = pgettext("person_name_salutation", salutation)
|
||||
given_name = None
|
||||
|
||||
return " ".join(filter(None, (salutation, title, given_name, family_name)))
|
||||
|
||||
|
||||
PERSON_NAME_SCHEMES = OrderedDict([
|
||||
('given_family', {
|
||||
'fields': (
|
||||
@@ -2613,6 +2632,7 @@ PERSON_NAME_SCHEMES = OrderedDict([
|
||||
'concatenation': lambda d: ' '.join(
|
||||
str(p) for p in (d.get(key, '') for key in ["given_name", "family_name"]) if p
|
||||
),
|
||||
'concatenation_for_salutation': concatenation_for_salutation,
|
||||
'sample': {
|
||||
'salutation': pgettext_lazy('person_name_sample', 'Mr'),
|
||||
'given_name': pgettext_lazy('person_name_sample', 'John'),
|
||||
@@ -2630,6 +2650,7 @@ PERSON_NAME_SCHEMES = OrderedDict([
|
||||
'concatenation': lambda d: ' '.join(
|
||||
str(p) for p in (d.get(key, '') for key in ["title", "given_name", "family_name"]) if p
|
||||
),
|
||||
'concatenation_for_salutation': concatenation_for_salutation,
|
||||
'sample': {
|
||||
'salutation': pgettext_lazy('person_name_sample', 'Mr'),
|
||||
'title': pgettext_lazy('person_name_sample', 'Dr'),
|
||||
@@ -2653,6 +2674,7 @@ PERSON_NAME_SCHEMES = OrderedDict([
|
||||
str((', ' if d.get('degree') else '')) +
|
||||
str(d.get('degree', ''))
|
||||
),
|
||||
'concatenation_for_salutation': concatenation_for_salutation,
|
||||
'sample': {
|
||||
'salutation': pgettext_lazy('person_name_sample', 'Mr'),
|
||||
'title': pgettext_lazy('person_name_sample', 'Dr'),
|
||||
|
||||
Reference in New Issue
Block a user