Skip to content

Commit ac0437b

Browse files
mesemustmorrell
authored andcommitted
i18n: replaced {} with %()s in gettext
Replaced gettext("...{aaa}...").format(aaa=) pattern with gettext("...%(aaa)s...", aaa=) to be more consistent with lazy_gettext uses.
1 parent 3deba89 commit ac0437b

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

invenio_stats/errors.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ def __init__(self, query_name):
7272
"""
7373
super(RESTException, self).__init__()
7474
self.query_name = query_name
75-
self.description = _("Unknown statistic '{}'").format(query_name)
75+
self.description = _(
76+
"Unknown statistic '%(query_name)s'", query_name=query_name
77+
)
7678

7779
code = 400

invenio_stats/views.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,10 @@ def post(self, **kwargs):
7979
if permission is not None and not permission.can():
8080
message = _(
8181
"You do not have a permission to query the "
82-
'statistic "{}" with those '
83-
"parameters"
84-
).format(stat)
82+
'statistic "%(stat)s" with those '
83+
"parameters",
84+
stat=stat,
85+
)
8586

8687
if current_user.is_authenticated:
8788
abort(403, message)

0 commit comments

Comments
 (0)