Re: Advanced Locale from URL middleware

2006-07-02 Thread jon1012
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

Re: Advanced Locale from URL middleware

2006-06-26 Thread jon1012
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

Re: Advanced Locale from URL middleware

2006-06-22 Thread Adrian Holovaty
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 --~--~-~--~~~

Re: Advanced Locale from URL middleware

2006-06-22 Thread jon1012
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

Advanced Locale from URL middleware

2006-06-22 Thread jon1012
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

Re: Locale from URL Middleware

2006-05-22 Thread David Larlet
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

Re: Locale from URL Middleware

2006-05-19 Thread jon1012
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

Re: Locale from URL Middleware

2006-05-19 Thread David Larlet
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

Re: Locale from URL Middleware

2006-04-07 Thread akaihola
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

Re: Locale from URL Middleware

2006-04-07 Thread Rudolph
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

Re: Locale from URL Middleware

2006-04-05 Thread limodou
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

Re: Locale from URL Middleware

2006-04-05 Thread atlithorn
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

Re: Locale from URL Middleware

2006-04-05 Thread Rudolph
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

Re: Locale from URL Middleware

2006-04-05 Thread akaihola
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

Re: Locale from URL Middleware

2006-04-05 Thread Jan Claeys
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

Re: Locale from URL Middleware

2006-04-05 Thread Simon Willison
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

Re: Locale from URL Middleware

2006-04-05 Thread atlithorn
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

Re: Locale from URL Middleware

2006-04-05 Thread limodou
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

Locale from URL Middleware

2006-04-05 Thread atlithorn
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: ##