On Fri, 2008-03-28 at 06:13 -0300, Marinho Brandao wrote: > Hi, > > I had tryied several ways a lot of time trying to localize my URLs, > like in django-authopenid [1] > > but I had have the same result: when I change the current language, > everything works but URLs stills in old language. When I restart > server, it works, but when I change again, the same happens... > > am I wrong trying to localize URLs or am I forgotting something important? > > example of my URLs: > > urlpatterns = patterns('', > url(r'^%s' % _('channels/'), include('apps.videos.urls.channels')), > }
That code is only going to be executed once: when the URL configuration is imported. Not on every request. So it won't work as you expect. If you really want to supply URL aliases like this, you'll need to do the processing in your view to work out which URL they really requested and dispatch that appropriately. That would be a very large amount of work, since you'd have to accept pretty much any legal string and then the view works out if it's valid or not and you would essentially be reimplementing the URL dispatcher from Django. This isn't impossible, but it's not something Django provides out of the box. Regards, Malcolm -- The cost of feathers has risen; even down is up! http://www.pointy-stick.com/blog/ --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---