Skip to content

Commit

Permalink
fix strings for extraction (#6421)
Browse files Browse the repository at this point in the history
  • Loading branch information
escattone authored Jan 6, 2025
1 parent 2861bbb commit f79a387
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions kitsune/announcements/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ def send_group_email(announcement_id):
@safe_translation
def _make_mail(locale, user):
if groups.count() == 1:
subject = _(f"New announcement for {groups[0].name}")
subject = _("New announcement for {name}").format(name=groups[0].name)
else:
subject = _(f"New announcement for groups [{', '.join([g.name for g in groups])}]")
subject = _("New announcement for groups [{names}]").format(
names=", ".join(g.name for g in groups)
)

mail = make_mail(
subject=subject,
Expand Down
2 changes: 1 addition & 1 deletion kitsune/sumo/form_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def to_python(self, value):
for key, value in key_value_pairs:
# check if the value is a valid username in the database
if key.lower() == "user" and not User.objects.filter(username=value).exists():
raise ValidationError(_(f"{value} is not a valid username."))
raise ValidationError(_("{name} is not a valid username.").format(name=value))
to_objects.setdefault(f"{key.lower()}s", []).append(value)

return to_objects
Expand Down

0 comments on commit f79a387

Please sign in to comment.