Skip to content

Commit 363d9df

Browse files
authored
apps/notifications: translation fixes (#3036)
1 parent f569cbf commit 363d9df

File tree

20 files changed

+210
-104
lines changed

20 files changed

+210
-104
lines changed

apps/notifications/services.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ def render(self, template_name, context):
6565
content_type_display=context.get("content_type_display", ""),
6666
creator_name=context.get("creator_name", ""),
6767
)
68+
if "cta_label" in context:
69+
context["cta_label"] = context["cta_label"].format(
70+
content_type_display=context.get("content_type_display", ""),
71+
)
6872
if "greeting" in context:
6973
context["greeting"] = context["greeting"].format(
7074
receiver_name=receiver.username

apps/notifications/strategies/project_strategies.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,11 @@ def create_notification_data(self, obj) -> dict:
298298
content_type_display = content_type
299299
first_letter = str(content_type_display)[0].lower()
300300
content_type_article = _("An") if first_letter in "aeiou" else _("A")
301+
content_type_translations = {
302+
"idea": _("idea"),
303+
"proposal": _("proposal"),
304+
"mapidea": _("mapidea"),
305+
}
301306
subject_translations = {
302307
"Idea": _("An idea was added to the project {project_name}"),
303308
"Proposal": _("A proposal was added to the project {project_name}"),
@@ -325,7 +330,6 @@ def create_notification_data(self, obj) -> dict:
325330
"{creator_name} created {article_lower} {content_type} on the project {project_name}"
326331
),
327332
)
328-
329333
email_context = {
330334
"subject": subject_template,
331335
"headline": headline_template,
@@ -342,8 +346,8 @@ def create_notification_data(self, obj) -> dict:
342346
"project_name": obj.project.name,
343347
"project": obj.project.name,
344348
"creator_name": obj.creator.username,
345-
"content_type": content_type.lower(),
346-
"content_type_display": content_type_display,
349+
"content_type": content_type_translations[content_type.lower()],
350+
"content_type_display": content_type_translations[content_type.lower()],
347351
"content_url": obj.get_absolute_url(),
348352
"site": obj.project.organisation.site,
349353
}
@@ -358,8 +362,10 @@ def create_notification_data(self, obj) -> dict:
358362
"project": obj.project.name,
359363
"project_url": obj.project.get_absolute_url(),
360364
"organisation": obj.project.organisation.name,
361-
"content_type": content_type.lower(),
362-
"content_type_display": content_type_display,
365+
"content_type": content_type_translations[content_type.lower()],
366+
"content_type_display": content_type_translations[
367+
content_type_display.lower()
368+
],
363369
"content": obj.name,
364370
"content_url": obj.get_absolute_url(),
365371
"creator_name": obj.creator.username,

apps/notifications/templatetags/notification_tags.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ def unread_notifications_count(context):
2020
def render_notification_with_links(notification):
2121
translated_template = _(notification.message_template) # Translate at render time
2222
context = notification.context
23-
2423
template_parts = translated_template.split("{")
2524

2625
result = []

locale-source/locale/de/LC_MESSAGES/django.po

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ msgid ""
1717
msgstr ""
1818
"Project-Id-Version: adhocracy-plus\n"
1919
"Report-Msgid-Bugs-To: \n"
20-
"POT-Creation-Date: 2026-01-29 14:39+0100\n"
20+
"POT-Creation-Date: 2026-01-29 17:29+0100\n"
2121
"PO-Revision-Date: 2020-11-12 13:23+0000\n"
2222
"Last-Translator: Tietje, 2026\n"
2323
"Language-Team: German (https://app.transifex.com/liqd/teams/109316/de/)\n"
@@ -3651,50 +3651,62 @@ msgstr "Das Projekt {project} wurde gelöscht"
36513651

36523652
#: apps/notifications/strategies/project_strategies.py:300
36533653
msgid "An"
3654-
msgstr "Eine"
3654+
msgstr "Ein/e"
36553655

36563656
#: apps/notifications/strategies/project_strategies.py:300
36573657
msgid "A"
3658-
msgstr "Eine"
3658+
msgstr "Ein/e"
36593659

36603660
#: apps/notifications/strategies/project_strategies.py:302
3661+
msgid "idea"
3662+
msgstr "Idee"
3663+
3664+
#: apps/notifications/strategies/project_strategies.py:303
3665+
msgid "proposal"
3666+
msgstr "Vorschlag"
3667+
3668+
#: apps/notifications/strategies/project_strategies.py:304
3669+
msgid "mapidea"
3670+
msgstr "Idee"
3671+
3672+
#: apps/notifications/strategies/project_strategies.py:307
36613673
#, python-brace-format
36623674
msgid "An idea was added to the project {project_name}"
36633675
msgstr "Neue Idee im Projekt {project_name}"
36643676

3665-
#: apps/notifications/strategies/project_strategies.py:303
3677+
#: apps/notifications/strategies/project_strategies.py:308
36663678
#, python-brace-format
36673679
msgid "A proposal was added to the project {project_name}"
36683680
msgstr "Neuer Vorschlag im Projekt {project_name}"
36693681

3670-
#: apps/notifications/strategies/project_strategies.py:304
3682+
#: apps/notifications/strategies/project_strategies.py:309
36713683
#, python-brace-format
36723684
msgid "A map idea was added to the project {project_name}"
36733685
msgstr "Neue Idee im Projekt {project_name}"
36743686

3675-
#: apps/notifications/strategies/project_strategies.py:308
3687+
#: apps/notifications/strategies/project_strategies.py:314
36763688
#, python-brace-format
36773689
msgid "{creator_name} created an idea on the project {project_name}"
36783690
msgstr "{creator_name} hat im Projekt {project_name} eine neue Idee angelegt"
36793691

3680-
#: apps/notifications/strategies/project_strategies.py:310
3692+
#: apps/notifications/strategies/project_strategies.py:316
36813693
#, python-brace-format
36823694
msgid "{creator_name} created a proposal on the project {project_name}"
36833695
msgstr ""
36843696
"{creator_name} hat im Projekt {project_name} einen neuen Vorschlag angelegt"
36853697

3686-
#: apps/notifications/strategies/project_strategies.py:313
3698+
#: apps/notifications/strategies/project_strategies.py:319
36873699
#, python-brace-format
36883700
msgid "{creator_name} created a map idea on the project {project_name}"
36893701
msgstr "{creator_name} hat im Projekt {project_name} eine neue Idee angelegt"
36903702

3691-
#: apps/notifications/strategies/project_strategies.py:320
3703+
#: apps/notifications/strategies/project_strategies.py:326
36923704
#, python-brace-format
36933705
msgid "{article} {content_type} was added to the project {project_name}"
36943706
msgstr ""
36953707
"{article} {content_type} wurde zum Projekt {project_name} hinzugefügt. "
36963708

3697-
#: apps/notifications/strategies/project_strategies.py:325
3709+
#: apps/notifications/strategies/project_strategies.py:331
36983710
#, python-brace-format
36993711
msgid ""
37003712
"{creator_name} created {article_lower} {content_type} on the project "
@@ -3703,12 +3715,12 @@ msgstr ""
37033715
"{creator_name} hat {article_lower} {content_type} im Projekt {project_name} "
37043716
"erstellt"
37053717

3706-
#: apps/notifications/strategies/project_strategies.py:333
3718+
#: apps/notifications/strategies/project_strategies.py:338
37073719
#, python-brace-format
37083720
msgid "Check the {content_type_display}"
37093721
msgstr "Überprüfen Sie {content_type_display}"
37103722

3711-
#: apps/notifications/strategies/project_strategies.py:335
3723+
#: apps/notifications/strategies/project_strategies.py:340
37123724
#, python-brace-format
37133725
msgid ""
37143726
"This email was sent to {receiver_email}. This email was sent to you because "
@@ -3717,7 +3729,7 @@ msgstr ""
37173729
"Diese E-Mail wurde an {receiver_email} gesendet. Sie erhalten diese E-Mail, "
37183730
"weil Sie Moderator:in im Projekt sind."
37193731

3720-
#: apps/notifications/strategies/project_strategies.py:355
3732+
#: apps/notifications/strategies/project_strategies.py:360
37213733
#, python-brace-format
37223734
msgid ""
37233735
"A new {content_type} \"{content}\" has been created in project {project}."

locale-source/locale/de/LC_MESSAGES/djangojs.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ msgid ""
1616
msgstr ""
1717
"Project-Id-Version: PACKAGE VERSION\n"
1818
"Report-Msgid-Bugs-To: \n"
19-
"POT-Creation-Date: 2026-01-29 14:39+0100\n"
19+
"POT-Creation-Date: 2026-01-29 17:29+0100\n"
2020
"PO-Revision-Date: 2020-11-12 13:23+0000\n"
2121
"Last-Translator: Tietje, 2026\n"
2222
"Language-Team: German (https://app.transifex.com/liqd/teams/109316/de/)\n"

locale-source/locale/en/LC_MESSAGES/django.po

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: adhocracy-plus\n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2026-01-29 14:39+0100\n"
11+
"POT-Creation-Date: 2026-01-29 17:29+0100\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language-Team: LANGUAGE <[email protected]>\n"
@@ -3492,41 +3492,53 @@ msgid "A"
34923492
msgstr "A"
34933493

34943494
#: apps/notifications/strategies/project_strategies.py:302
3495+
msgid "idea"
3496+
msgstr "idea"
3497+
3498+
#: apps/notifications/strategies/project_strategies.py:303
3499+
msgid "proposal"
3500+
msgstr "proposal"
3501+
3502+
#: apps/notifications/strategies/project_strategies.py:304
3503+
msgid "mapidea"
3504+
msgstr "mapidea"
3505+
3506+
#: apps/notifications/strategies/project_strategies.py:307
34953507
#, python-brace-format
34963508
msgid "An idea was added to the project {project_name}"
34973509
msgstr "An idea was added to the project {project_name}"
34983510

3499-
#: apps/notifications/strategies/project_strategies.py:303
3511+
#: apps/notifications/strategies/project_strategies.py:308
35003512
#, python-brace-format
35013513
msgid "A proposal was added to the project {project_name}"
35023514
msgstr "A proposal was added to the project {project_name}"
35033515

3504-
#: apps/notifications/strategies/project_strategies.py:304
3516+
#: apps/notifications/strategies/project_strategies.py:309
35053517
#, python-brace-format
35063518
msgid "A map idea was added to the project {project_name}"
35073519
msgstr "A map idea was added to the project {project_name}"
35083520

3509-
#: apps/notifications/strategies/project_strategies.py:308
3521+
#: apps/notifications/strategies/project_strategies.py:314
35103522
#, python-brace-format
35113523
msgid "{creator_name} created an idea on the project {project_name}"
35123524
msgstr "{creator_name} created an idea on the project {project_name}"
35133525

3514-
#: apps/notifications/strategies/project_strategies.py:310
3526+
#: apps/notifications/strategies/project_strategies.py:316
35153527
#, python-brace-format
35163528
msgid "{creator_name} created a proposal on the project {project_name}"
35173529
msgstr "{creator_name} created a proposal on the project {project_name}"
35183530

3519-
#: apps/notifications/strategies/project_strategies.py:313
3531+
#: apps/notifications/strategies/project_strategies.py:319
35203532
#, python-brace-format
35213533
msgid "{creator_name} created a map idea on the project {project_name}"
35223534
msgstr "{creator_name} created a map idea on the project {project_name}"
35233535

3524-
#: apps/notifications/strategies/project_strategies.py:320
3536+
#: apps/notifications/strategies/project_strategies.py:326
35253537
#, python-brace-format
35263538
msgid "{article} {content_type} was added to the project {project_name}"
35273539
msgstr "{article} {content_type} was added to the project {project_name}"
35283540

3529-
#: apps/notifications/strategies/project_strategies.py:325
3541+
#: apps/notifications/strategies/project_strategies.py:331
35303542
#, python-brace-format
35313543
msgid ""
35323544
"{creator_name} created {article_lower} {content_type} on the project "
@@ -3535,12 +3547,12 @@ msgstr ""
35353547
"{creator_name} created {article_lower} {content_type} on the project "
35363548
"{project_name}"
35373549

3538-
#: apps/notifications/strategies/project_strategies.py:333
3550+
#: apps/notifications/strategies/project_strategies.py:338
35393551
#, python-brace-format
35403552
msgid "Check the {content_type_display}"
35413553
msgstr "Check the {content_type_display}"
35423554

3543-
#: apps/notifications/strategies/project_strategies.py:335
3555+
#: apps/notifications/strategies/project_strategies.py:340
35443556
#, python-brace-format
35453557
msgid ""
35463558
"This email was sent to {receiver_email}. This email was sent to you because "
@@ -3549,7 +3561,7 @@ msgstr ""
35493561
"This email was sent to {receiver_email}. This email was sent to you because "
35503562
"you are a moderator in the project."
35513563

3552-
#: apps/notifications/strategies/project_strategies.py:355
3564+
#: apps/notifications/strategies/project_strategies.py:360
35533565
#, python-brace-format
35543566
msgid ""
35553567
"A new {content_type} \"{content}\" has been created in project {project}."

locale-source/locale/en/LC_MESSAGES/djangojs.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: PACKAGE VERSION\n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2026-01-29 14:39+0100\n"
10+
"POT-Creation-Date: 2026-01-29 17:29+0100\n"
1111
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1212
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1313
"Language-Team: LANGUAGE <[email protected]>\n"

locale-source/locale/hu/LC_MESSAGES/django.po

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ msgid ""
1212
msgstr ""
1313
"Project-Id-Version: adhocracy-plus\n"
1414
"Report-Msgid-Bugs-To: \n"
15-
"POT-Creation-Date: 2026-01-29 14:39+0100\n"
15+
"POT-Creation-Date: 2026-01-29 17:29+0100\n"
1616
"PO-Revision-Date: 2020-11-12 13:23+0000\n"
1717
"Last-Translator: János Gerzson <[email protected]>, 2025\n"
1818
"Language-Team: Hungarian (https://app.transifex.com/liqd/teams/109316/hu/)\n"
@@ -3412,60 +3412,72 @@ msgid "A"
34123412
msgstr ""
34133413

34143414
#: apps/notifications/strategies/project_strategies.py:302
3415+
msgid "idea"
3416+
msgstr ""
3417+
3418+
#: apps/notifications/strategies/project_strategies.py:303
3419+
msgid "proposal"
3420+
msgstr ""
3421+
3422+
#: apps/notifications/strategies/project_strategies.py:304
3423+
msgid "mapidea"
3424+
msgstr ""
3425+
3426+
#: apps/notifications/strategies/project_strategies.py:307
34153427
#, python-brace-format
34163428
msgid "An idea was added to the project {project_name}"
34173429
msgstr ""
34183430

3419-
#: apps/notifications/strategies/project_strategies.py:303
3431+
#: apps/notifications/strategies/project_strategies.py:308
34203432
#, python-brace-format
34213433
msgid "A proposal was added to the project {project_name}"
34223434
msgstr ""
34233435

3424-
#: apps/notifications/strategies/project_strategies.py:304
3436+
#: apps/notifications/strategies/project_strategies.py:309
34253437
#, python-brace-format
34263438
msgid "A map idea was added to the project {project_name}"
34273439
msgstr ""
34283440

3429-
#: apps/notifications/strategies/project_strategies.py:308
3441+
#: apps/notifications/strategies/project_strategies.py:314
34303442
#, python-brace-format
34313443
msgid "{creator_name} created an idea on the project {project_name}"
34323444
msgstr ""
34333445

3434-
#: apps/notifications/strategies/project_strategies.py:310
3446+
#: apps/notifications/strategies/project_strategies.py:316
34353447
#, python-brace-format
34363448
msgid "{creator_name} created a proposal on the project {project_name}"
34373449
msgstr ""
34383450

3439-
#: apps/notifications/strategies/project_strategies.py:313
3451+
#: apps/notifications/strategies/project_strategies.py:319
34403452
#, python-brace-format
34413453
msgid "{creator_name} created a map idea on the project {project_name}"
34423454
msgstr ""
34433455

3444-
#: apps/notifications/strategies/project_strategies.py:320
3456+
#: apps/notifications/strategies/project_strategies.py:326
34453457
#, python-brace-format
34463458
msgid "{article} {content_type} was added to the project {project_name}"
34473459
msgstr ""
34483460

3449-
#: apps/notifications/strategies/project_strategies.py:325
3461+
#: apps/notifications/strategies/project_strategies.py:331
34503462
#, python-brace-format
34513463
msgid ""
34523464
"{creator_name} created {article_lower} {content_type} on the project "
34533465
"{project_name}"
34543466
msgstr ""
34553467

3456-
#: apps/notifications/strategies/project_strategies.py:333
3468+
#: apps/notifications/strategies/project_strategies.py:338
34573469
#, python-brace-format
34583470
msgid "Check the {content_type_display}"
34593471
msgstr ""
34603472

3461-
#: apps/notifications/strategies/project_strategies.py:335
3473+
#: apps/notifications/strategies/project_strategies.py:340
34623474
#, python-brace-format
34633475
msgid ""
34643476
"This email was sent to {receiver_email}. This email was sent to you because "
34653477
"you are a moderator in the project."
34663478
msgstr ""
34673479

3468-
#: apps/notifications/strategies/project_strategies.py:355
3480+
#: apps/notifications/strategies/project_strategies.py:360
34693481
#, python-brace-format
34703482
msgid ""
34713483
"A new {content_type} \"{content}\" has been created in project {project}."

locale-source/locale/hu/LC_MESSAGES/djangojs.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: PACKAGE VERSION\n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2026-01-29 14:39+0100\n"
10+
"POT-Creation-Date: 2026-01-29 17:29+0100\n"
1111
"PO-Revision-Date: 2020-11-12 13:23+0000\n"
1212
"Language-Team: Hungarian (https://app.transifex.com/liqd/teams/109316/hu/)\n"
1313
"Language: hu\n"

0 commit comments

Comments
 (0)