Hi Adrian,
Here is my blog post about it (in french and english):
http://www.jondesign.net/articles/2006/jul/02/langue-depuis-url-django-url-locale-middleware/
I'll put it on the wiki.
Jon
--~--~-~--~~~---~--~~
You received this message because you are subscri
Hi Adrian,
Ok, no problem, I'll just post a message on my blog and link to it from
the wiki page.
Jon
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to djan
the last code has a bug, here is the new one, and sorry :)
class LocaleURLMiddleware:
def get_language_from_request (self,request):
from django.conf import settings
import re
supported = dict(settings.LANGUAGES)
lang = settin
A middleware that permits to change the locale based on the url was
posted here one month ago by Atlithorn.
For example, when you go to /fr/article/*** you get the article in
french, and when you go to /en/article/*** you get the article in
english...
I've gone a little further making a version
I've done an helper function that strips the selected language from the
current url and return it... Usefull to make a language change button..
All you have to do is to make a link to the url with '/fr' for example
in front of the value given by the function:
from django.conf import settings
def
5 matches
Mail list logo