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
On 6/22/06, jon1012 <[EMAIL PROTECTED]> wrote:
> the last code has a bug, here is the new one, and sorry :)
Hi Jon,
Can you post that to http://code.djangoproject.com/wiki/ContributedMiddleware ?
Adrian
--
Adrian Holovaty
holovaty.com | djangoproject.com
--~--~-~--~~~
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
2006/5/19, jon1012 <[EMAIL PROTECTED]>:
I've done an helper function that strips the selected language from thecurrent 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:Th
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
2006/4/5, Rudolph <[EMAIL PROTECTED]>:
I would like to add another good reason: Another nice effect languagecodes in the URL is that search engine crawlers can easily get all yourcontent.My customers often want something like this:
www.example.com -> site in the main language of your visitorswww.ex
A downside in this is increased complexity when generating links
between pages.
--~--~-~--~~~---~--~~
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.co
Optional middleware seems okay, or perhaps we can just set up a
wiki-page on the Django site about this so everybody can implement this
their own way.
Rudolph
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django
On 4/5/06, Simon Willison <[EMAIL PROTECTED]> wrote:
>
> On 5 Apr 2006, at 12:26, limodou wrote:
>
> > Why you need do this? Because django can auto judge the language from
> > your browser request http head, or context settings, or settings. If
> > you like , you can provide a language selection
Glad I am not alone :) There is a little irritation in using the
middleware posted above because I obviously have to account for the
language in all lines in my urls.py (r'(\w\w/)?... and so on). I would
prefer for this to have the same result as using an "include"
statement, ie the prefix would b
I would like to add another good reason: Another nice effect language
codes in the URL is that search engine crawlers can easily get all your
content.
My customers often want something like this:
www.example.com -> site in the main language of your visitors
www.example.nl -> site in Dutch
www.ex
I very much agree with Simon and Jan. A middleware like this would be
nice to have in django.contrib.
One useful enhancement would be the ability to specify in where in the
URL the language can be specified. On one of my sites the syntax of the
URL is always /userid/locale/page... so it would be
Op wo, 05-04-2006 te 16:34 +0100, schreef Simon Willison:
> I for one much prefer the language to be specified in the URL
Or sometimes using a cookie...
> rather
> than being derived from the browser settings. I would prefer this
> behaviour to be supported (at least as an option) in Django
On 5 Apr 2006, at 12:26, limodou wrote:
> Why you need do this? Because django can auto judge the language from
> your browser request http head, or context settings, or settings. If
> you like , you can provide a language selection in web page, and
> that's enough. The url doesnot need to be spe
I understand how django does it. Unfortunately I am forced to maintain
a web structure that requires this functionality so that's why I wrote
it. But I actually prefer this over the ambiguity in the browser
settings which most people do not set anyway and the extra step
required to select the righ
On 4/5/06, atlithorn <[EMAIL PROTECTED]> wrote:
>
> Just in case anyone is interested... I wrote my own middleware class to
> support selecting languages from the URL itself. eg:
>
> www.example.com - default english
> www.example.com/de - same page with german trans
>
> It was a simple copy-paste
Just in case anyone is interested... I wrote my own middleware class to
support selecting languages from the URL itself. eg:
www.example.com - default english
www.example.com/de - same page with german trans
It was a simple copy-paste of the LocaleMiddleWare from the distro:
##
19 matches
Mail list logo