0

I'm creating a signal that sends messages to multiple users, and each message should be translated to the receiver's language.

this is a simplified example of that the alert handler does:

def alert_handler(**kwargs):
    t_message = kwargs.pop("message", None)
    context = kwargs.pop("context", None)

    for recipient in recipients:
        activate(recipient.language)
        message = _(t_message, context)
        new_alert = Alert(recipient=recipient, message=message)
       

This works as intended but the makemessages command doesn't recognize the sting passed in the kwargs as a translatable string.

Is it possible to flag a string to be picked up by the makemessages command?

pmcoelho
  • 1
  • 2
  • The problem is that `t_message` can be *anything*, so you can not use that to make translations. What items to translate would it suggest? – Willem Van Onsem Nov 26 '20 at 11:55
  • `t_message` can be anything, but if it is a string present in the translation file it will translate, what I'm asking is if it is possible to add strings to be recognized by `makemessages` without it being a `gettext` argument – pmcoelho Nov 26 '20 at 12:05

0 Answers0