Hi Lars - > > I have an existing site, and want to add the page language to the URLs > > so that caching will work correctly, e.g. "/foo/bar" would now look like > > "/en/foo/bar" or "/fr/foo/bar". > > Apart from the missing true return value from auto, this works: > > http://lists.scsys.co.uk/pipermail/catalyst/2009-February/021072.html
Thanks for the pointer. But this approach only seems to work for Local actions, not Private actions like default(). E.g. using these controllers: #------------------------------------------------ package MyApp::Controller::Foo; use parent 'Catalyst::Controller'; sub default :Private { my ($self, $c, @args) = @_; $c->response->body("Foo args: @args"); } sub bar :Local { my ($self, $c, @args) = @_; $c->response->body("Foo::Bar args: @args"); } #------------------------------------------------ package MyApp::Controller::En; use parent 'Catalyst::Controller'; sub default :Private { my ($self, $c, @args) = @_; my $path = $c->request->path; $path =~ s{^en}{}; $c->go($path, []); } #------------------------------------------------ The paths "/en/foo/bar" or "/en/foo/bar/arg1" work as expected, but if I try to hit "/en/foo" I get an error message: Couldn't go to command "/foo": Invalid action or component. because the action name it wants is really "/foo/default", not just "/foo". For a path like "/a/b/c", I would need to figure out whether to do this: # Will hit: A::B with arg 'c' # or: A::B::C with no args # $c->go("/a/b/c", []); vs this: $c->go("/a/default", ['b', 'c']); vs this: $c->go("/a/b/default", ['c']); ? I'm guessing there must be a way to use the Dispatcher to figure out, for a given path, how to make go() work consistently, but I have not yet found the trick for making this work... Thanks! Larry _______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/