Allow the use of translation.override as a decorator
|Reported by:||Thomas Chaumeny||Owned by:||nobody|
|Cc:||Simon Charette||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I think it would be nice if
translation.override could be used as a decorator.
Although a comment in https://code.djangoproject.com/ticket/16690#comment:2 suggested this was not useful, I have experienced several cases where it is. For instance, I have some functions which are sending mail and I want those mails to be translated in some default language which is not the one of the user doing the action. Having the function decorated is better in terms of readability than a long
with statement which introduces heavy indentation.