Friday, December 3, 2010

Debug internalization

Hello,

I am trying to use Djangos internalization framework - but struggling
a bit ...

In my settings.py file I have:

LANGUAGES = (
("en" , ugettext("English")),
("no" , ugettext("Norwegian")),
("sv" , ugettext("Swedish")),
("dk" , ugettext("Danish")))

LANGUAGE_CODE = 'en-us'


MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
.....


In my view I have:


from django.utils.translation import ugettext

def view_local(request):
msg = ugettext("Local message")
return render_to_context(....)


Now my problem is that the ugettext() function will only return the
literal input string, whatever I pass it. In the beginning I of course
passed in strings I had a translation for, but e.g.

msg = ugettext("Message_without_any_translation")

will just work "fine". So I guess I wonder if it is possible to get
some debug info from this, i.e. in development mode I would prefer the
ugettext() function to crash and burn if the msgid can not be found
instead of just return the msgid. Any tips on this?

Regards Joakim


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate