In Django simple and inclusion template tags allow getting the request context with
@register.simple_tag(takes_context=True)
Official documentation for custom template tags - inclusion tags.
However, for custom tags, I don't see how this is done.
What I am trying to do is extend the i18n {% trans %} tag, to look for translation in the database first, before using gettext. I need access to the request.Language from the custom template tag.