I use the breadcrumbs block in the admin interface to add a link to a
view
using :
(in template)
<div id="breadcrumbs"
 <p><span class="breadcrumbs">
<a class="discreet_link" href="{% url content.views.set_language
lang_code="fr" %}">Fr</a>&nbsp;|&nbsp;
<a class="discreet_link" href="{% url content.views.set_language
lang_code="nl" %}">Nl</a>&nbsp;|&nbsp;
<a class="discreet_link" href="{% url content.views.set_language
lang_code="en" %}">En</a>&nbsp;|&nbsp;
<a class="discreet_link" href="{% url content.views.set_language
lang_code="ja" %}"> >日本語</a>&nbsp;
</span></p>
 (for each language, in every page, impractical if you have many, but
you can replace that by a special page of links if that's the case
(like google's language switch page) )
</div>

(in url.py)
    (r'^lang/(?P<lang_code>[a-zA-Z]+)/$',set_language),


And then I just set the language cookie manually
(in views.py)

def set_language(request,**kwargs):
    next = request.REQUEST.get('next', None)
    if not next:
         next = request.META.get('HTTP_REFERER', None)
    if not next:
         next = '/'
    lang_code = kwargs.get("lang_code",None)
    response=HttpResponseRedirect(next)
    if lang_code and check_for_language(lang_code):
        if hasattr(request, 'session'):
            request.session['django_language'] = lang_code
        else:
            response.set_cookie(settings.LANGUAGE_COOKIE_NAME,
lang_code)
    return response



On Nov 7, 9:49 am, Antoni Aloy <antoni.a...@gmail.com> wrote:
> 2009/11/7 Kenneth Gonsalves <law...@au-kbc.org>:
>
>
>
> > hi,
>
> > I have an app in two languages. Until now I was asking the users to change 
> > the
> > language in their browser. I have now implemented setlang in the web
> > interface, so that they can view in the language of their choice by choosing
> > the language. I now want to do this in admin - a custom form should do it, 
> > but
> > has anyone done this? Or is it going to come to admin? Or maybe it is there
> > and I have not noticed it?
>
> And letting the users to change their language modifiying the main
> admin template and giving them a change language form?
>
> --
> Antoni Aloy López
> Blog:http://trespams.com
> Site:http://apsl.net

--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to