Skip to content

Commit

Permalink
i18n: update string formatting to use legacy method
Browse files Browse the repository at this point in the history
  • Loading branch information
Samk13 committed Feb 18, 2025
1 parent a3ae594 commit 4d02b70
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
12 changes: 6 additions & 6 deletions invenio_communities/communities/services/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ def _create_set_spec(self, community_slug):

def _create_set_description(self, community_title):
# NOTE: Does not require translation since this description can also be changed by an admin
return _("Records belonging to the community '{title}'").format(
title=community_title
)
return _("Records belonging to the community '%(title)s'") % {
"title": str(community_title)
}

def _create_set_from_community(self, record):
community_slug = record.slug
Expand All @@ -174,9 +174,9 @@ def _create_set_from_community(self, record):
community_set.system_created = True
community_set.description = self._create_set_description(community_title)
community_set.spec = self._create_set_spec(community_slug)
community_set.search_pattern = _("parent.communities.ids:{id}").format(
id=record.id
)
community_set.search_pattern = _("parent.communities.ids:%(id)s") % {
"id": record.id
}

return community_set

Expand Down
5 changes: 2 additions & 3 deletions invenio_communities/members/services/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,8 @@ def _member_changed(self, member, community=None):
return
else:
raise TypeError(
_("Member must be 'MemberMixin' or 'dict' but was {type}").format(
type=type(member)
)
_("Member must be 'MemberMixin' or 'dict' but was %(type)s")
% {"type": type(member)}
)

for user_id in user_ids:
Expand Down

0 comments on commit 4d02b70

Please sign in to comment.