Mercurial > p > roundup > code
comparison roundup/rest.py @ 7750:216662fbaaee
fix(i18n): fix incorrect lookup of some translations
The code had:
_("some term %s here" % term)
this extracts the template, but looks up the string with %s replaced.
So the translation is broken. Changed to:
_("some term %s here") % term
which looks up the template and substitutes in the translation of the
template.
Found by ruff INT ruleset.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Fri, 01 Mar 2024 14:04:05 -0500 |
| parents | 6f66d74d37f3 |
| children | 03c1b7ae3a68 |
comparison
equal
deleted
inserted
replaced
| 7749:79344ea780ea | 7750:216662fbaaee |
|---|---|
| 1108 etag = calculate_etag(node, self.db.config.WEB_SECRET_KEY, | 1108 etag = calculate_etag(node, self.db.config.WEB_SECRET_KEY, |
| 1109 class_name, item_id, repr_format="json") | 1109 class_name, item_id, repr_format="json") |
| 1110 try: | 1110 try: |
| 1111 data = node.__getattr__(attr_name) | 1111 data = node.__getattr__(attr_name) |
| 1112 except AttributeError: | 1112 except AttributeError: |
| 1113 raise UsageError(_("Invalid attribute %s" % attr_name)) | 1113 raise UsageError(_("Invalid attribute %s") % attr_name) |
| 1114 result = { | 1114 result = { |
| 1115 'id': item_id, | 1115 'id': item_id, |
| 1116 'type': str(type(data)), | 1116 'type': str(type(data)), |
| 1117 'link': "%s/%s/%s/%s" % | 1117 'link': "%s/%s/%s/%s" % |
| 1118 (self.data_path, class_name, item_id, attr_name), | 1118 (self.data_path, class_name, item_id, attr_name), |
