Skip to content

Commit

Permalink
i18n: update string formatting to use percent-style for invitations a…
Browse files Browse the repository at this point in the history
…nd requests
  • Loading branch information
Samk13 committed Feb 18, 2025
1 parent 4d02b70 commit b6a1d48
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
22 changes: 10 additions & 12 deletions invenio_communities/members/services/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,10 +281,10 @@ def _invite_factory(self, identity, community, role, visible, member, message, u
# Add member entry
if member["type"] == "user":
# Create request
title = _('Invitation to join "{community}"').format(
community=community.metadata["title"],
)
description = _('You will join as "{role}".').format(role=role.title)
title = _('Invitation to join "%(community)s"') % {
"community": community.metadata["title"]
}
description = _('You will join as "%(role)s".') % {"role": role.title}

request_item = current_requests_service.create(
identity,
Expand Down Expand Up @@ -587,11 +587,9 @@ def _update(self, identity, community, member, role, visible, uow):
data = {
"payload": {
"content": _(
'You will join as "{role}" (changed from: "{previous}").'
).format(
role=role.title,
previous=member.role,
),
'You will join as "%(role)s" (changed from: "%(previous)s").'
)
% {"role": role.title, "previous": member.role},
}
}
current_events_service.create(
Expand Down Expand Up @@ -765,9 +763,9 @@ def request_membership(self, identity, community_id, data, uow=None):
)

# Create request
title = _('Request to join "{community}"').format(
community=community.metadata["title"],
)
title = _('Request to join "%(community)s"') % {
"community": community.metadata["title"]
}
request_item = current_requests_service.create(
identity,
data={
Expand Down
5 changes: 2 additions & 3 deletions invenio_communities/subcommunities/services/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,8 @@ def join(self, identity, id_, data, uow=None):

# Create and submit the request
request_data = {
"title": _('Inclusion of subcommunity "{community}"').format(
community=community.metadata["title"]
)
"title": _('Inclusion of subcommunity "%(community)s"')
% {"community": community.metadata["title"]}
}
request_payload = data.get("payload")
if request_payload:
Expand Down

0 comments on commit b6a1d48

Please sign in to comment.