Opened 21 months ago

Closed 21 months ago

Last modified 21 months ago

#23323 closed New feature (fixed)

Allow the use of translation.override as a decorator

Reported by: tchaumeny Owned by: nobody
Component: Translations Version: master
Severity: Normal Keywords:
Cc: charettes Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I think it would be nice if translation.override could be used as a decorator.

Although a comment in 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.

Change History (5)

comment:1 Changed 21 months ago by tchaumeny

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Here is my pull request for this feature:

comment:2 Changed 21 months ago by charettes

  • Cc charettes added
  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 21 months ago by charettes

  • Triage Stage changed from Accepted to Ready for checkin

Will commit after a final review.

comment:4 Changed 21 months ago by Simon Charette <charette.s@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 2db1ed1033c0f542b3ffcbbb970d1b4dc881900f:

Fixed #23323 -- Made django.utils.translation.override usable as a decorator.

comment:5 Changed 21 months ago by Simon Charette <charette.s@…>

In 4926c0afe3ff8f306f752b9ae45366cc8fd3e42c:

Documented translation.override as a decorator.

refs #23323.

Note: See TracTickets for help on using tickets.
Back to Top