List Info

Thread: I18N on loader.get_template not working for me




I18N on loader.get_template not working for me
user name
2007-02-28 07:14:47
I have a testing view that uses loader.get_template/render(context) combo,
and in settings.py I have put:
TEMPLATE_CONTEXT_PROCESSORS = (
       ;           ;           ;   "django.core.context_processors.auth",
        ;           ;           ;  "django.core.context_processors.debug",
          ;           ;           "django.core.context_processors.i18n",
 ;           ;           ;         )

but I don't get the LANGUAGES tuple on the rendered page, and hence a form from the extendable
template is not working:

------Renders nothing----------
{% for lang in LANGUAGES %}
<option value=&quot;{{ lang.0 }}"&gt;{{ lang.1 }}</option>
{% endfor %}
------Renders nothing----------

Is there anything else I should do for it to work ?, maybe call some i18n module on view ?

i18n works just fine on generic views with a very similar template.

Max

p.d. I sent a question about cache_page decorator but nobody has made any commentary, is there any magic to make it work too?

--
<?php
$signautre = null;
echo $signature;
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users"; group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to django-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Re: I18N on loader.get_template not working for me
country flaguser name
Australia
2007-02-28 07:19:22
On Wed, 2007-02-28 at 07:14 -0600, GaRaGeD Style wrote:
> I have a testing view that uses
loader.get_template/render(context)
> combo,
> and in settings.py I have put:
> TEMPLATE_CONTEXT_PROCESSORS = (
> 
> "django.core.context_processors.auth", 
> 
> "django.core.context_processors.debug",
>                                
"django.core.context_processors.i18n",
>                                 )
> 
> but I don't get the LANGUAGES tuple on the rendered
page, and hence a
> form from the extendable 
> template is not working:
> 
> ------Renders nothing----------
> {% for lang in LANGUAGES %}
> <option value="{{ lang.0 }}">{{ lang.1
}}</option>
> {% endfor %}
> ------Renders nothing---------- 

Are you using a RequestContext() class when you render your
template? If
you are just using a Context() class, you won't see any
effect from
context processors.

If what I just wrote seems like a foreign language (and a
quick search
of the djangoproject.com doesn't clear it up for you), post
an example
of how you are trying to render this template. Somewhere in
your view
will be a call to render_to_html() or something similar.
What does that
line look like?

Regards,
Malcolm



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


Re: I18N on loader.get_template not working for me
country flaguser name
Australia
2007-02-28 07:54:02
On Wed, 2007-02-28 at 07:39 -0600, GaRaGeD Style wrote:
[...]
> Any idea on the cache_page decorator problem  ? I'm
working on SVN
> trunk  so it could be a transitory problem, but has
been with me for a
> couple of weeks, and trunk is usually pretty stable and
flawless. 

Please look in the Google Groups archives, a reply was
posted there
quite a few hours ago. Let's restrict each thread to just
one main
topic. 

Thanks,
Malcolm



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


Re: I18N on loader.get_template not working for me
user name
2007-02-28 07:39:36



Are you using a RequestContext() class when you render your template? If
you are just using a Context() class, you won't see any effect from
context processors.

If what I just wrote seems like a foreign language (and a quick search
of the djangoproject.com doesn't clear it up for you), post an example
of how you are trying to render this template. Somewhere in your view
will be a call to render_to_html() or something similar. What does that
line look like?
&nbsp;
Totally right ! Thanks Malcolm

I had a Request() call with the parameter, instead of RequestContext, I missed the "subtle" difference of those calls on the manual, Sorry ! totally nuby.

Thanks a lot !

Any idea on the cache_page decorator problem ? I'm working on SVN trunk ; so it could be a transitory problem, but has been with me for a couple of weeks, and trunk is usually pretty stable and flawless.

Max
--
<?php
$signautre = null;
echo $signature;
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users"; group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to django-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )