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?

asked Nov 26, 2020 at 11:53
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? Commented Nov 26, 2020 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 Commented Nov 26, 2020 at 12:05

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.