Skip to content

Commit 465b7dc

Browse files
committed
Messages that are just strings and not TranslationStrings are now formatted with any given tokens on send.
1 parent c8d5bd9 commit 465b7dc

File tree

1 file changed

+4
-1
lines changed
  • addons/source-python/packages/source-python/messages

1 file changed

+4
-1
lines changed

addons/source-python/packages/source-python/messages/base.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ def _translate(value, language, tokens):
122122
if isinstance(value, TranslationStrings):
123123
return value.get_string(language, **tokens)
124124

125-
return value
125+
try:
126+
return value.format(**tokens)
127+
except (KeyError, AttributeError):
128+
return value
126129

127130
def protobuf(self, buffer, translated_kwargs):
128131
"""Protobuf implementation of this user message."""

0 commit comments

Comments
 (0)