Login

ugettext tag

Author:
jezdez
Posted:
May 28, 2008
Language:
Python
Version:
.96
Tags:
tag i18n ugettext
Score:
-1 (after 3 ratings)

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

  1. Template tag to dump database query info by pryankster 8 years, 2 months ago
  2. Tag that parses args and kwargs by fivethreeo 6 years, 9 months ago
  3. Automatically read the ID3 tag from a mp3 on save by sbaechler 3 years, 9 months ago
  4. csrf_token for mako by damd 5 years, 1 month ago
  5. Template tag: Group variables into list by Killarny 6 years, 3 months ago

Comments

gehel (on May 29, 2008):

That might be a dumb question, but how is this different from using that standard {%trans "some message" %} ?

#

jezdez (on June 2, 2008):

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.