[Catalyst] Multilanguage application

Matt S Trout dbix-class at trout.me.uk
Thu Aug 10 18:07:44 CEST 2006


Renaud Drousies wrote:
> On Thu, August 10, 2006 4:39 pm, Matt S Trout said:
>> sub lang :Chained('/') :CaptureArgs(1) :PathPart('') {
>>    my ($self, $c, $lang) = @_;
>>    <set lang appropriately>
>> }
>>
>> sub foo :Chained('/lang') :Args(0) { # /en/foo etc.
>>
>> Chained was designed to support this sort of stuff without the need for
>> prepare_path hacks, which I've used before but always found a tad ugly.
>>
> 
> But then I am not sure to understand how to dispatch actions correctly to
> different controllers. This looks like all actions must be defined in the
> same controller.

No, that "sub foo" could be in any controller.

> If I have that 'sub lang' in my Root controller, how can I reach my
> original 'sub index: Private' in MyApp::C::Foo (or any other action
> defined there) so that the Foo controller is used when I request /en/foo?

read the Catalyst::DispatchType::Chained POD first. If you still have 
questions, ask 'em then :)



More information about the Catalyst mailing list