I need translation to be activated in all of my django management commands by default. Currently I'm putting this line of code in all my management commands:
translation.activate(settings.LANGUAGE_CODE)
And sometimes I forget to consider it in my command. I need it to send translated notifications. Is there any way to activate translation for all of management commands by default?
Any help is appreciated.
After looking into
BaseCommand's source I figured out django is disabling translation and I could just prevent that by adding an attribute inside myCommandclass:I did put that line in my custom BaseCommand to be applied in all inherited commands.