This translates a given message with ugettext. That's it.
{% load where_you_have_it %}
{% ugettext "German" %}
1 2 3 4 5 6 7 8 9 | from django.utils.translation import ugettext
from django import template
register = template.Library()
def do_ugettext(msg):
"""Returns the gettext translation of the given message"""
return ugettext(msg)
register.simple_tag('ugettext', do_ugettext)
|
More like this
- Form field with fixed value by roam 1 week, 4 days ago
- New Snippet! by Antoliny0919 2 weeks, 4 days ago
- Add Toggle Switch Widget to Django Forms by OgliariNatan 3 months, 1 week ago
- get_object_or_none by azwdevops 6 months, 4 weeks ago
- Mask sensitive data from logger by agusmakmun 8 months, 3 weeks ago
Comments
That might be a dumb question, but how is this different from using that standard {%trans "some message" %} ?
#
It's smaller, doesn't use a Node subclass and doesn't force me to load the whole i18n tag lib.
#
Please login first before commenting.