[Catalyst] RFC on how to structure controllers

Matt S Trout dbix-class at trout.me.uk
Thu Jun 15 17:46:46 CEST 2006


Zbigniew Lukasiak wrote:
> Hi,
> 
> The ChildOf mechanism looks promising.  But after reading the docs I
> still don't know how to make a multilingual or branded site (without
> too much hassle).  I'll present here my guesses - please correct me if
> I don't understand the docs.
> 
> So I can build the language consumer:
> 
> sub lang_handler :PathPart('lang') :ChildOf('/') :Captures(1) {
>  	      my ( $self, $c ) = @_;
> 	      $c->stash->{'lang'} =   $c->req->captures->[0];
> }
> 
> But it than seems that then for every other action I would have to add
> the :PathPart and :ChildOf('/lang') attributes (to declare that they
> are childred on the 'lang').  This seems a bit excessive.

package MyApp::ControllerBase;

__PACKAGE__->config(actions => { '*' => { ChildOf => [ '/lang' ] } });

1;

In any case, quite a few internationalised sites have a few URLs that *don't* 
go through the language selection. Got to support them somehow ...

-- 
      Matt S Trout       Offering custom development, consultancy and support
   Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list