[Catalyst] getting TT to translate automatically

A. Pagaltzis pagaltzis at gmx.de
Sun Apr 9 21:23:49 CEST 2006


Hi Daniel,

* Daniel McBrearty <danielmcbrearty at gmail.com> [2006-04-09 15:00]:
> The way my current implementation works is that all text for
> the site is in a database, each row has a text mnemonic as
> primary key. You get back text in a given language by doing
> something like::
> 
> $text = Sitetext::get( $lang, $key);
> 
> You can also do substitution of variables like this :
> 
> $text = Sitetext::get( $lang, $key, {NAME => "Pierre"});
> 
> 
> What I'd like to do is get TT to do this automatically for all
> items on the page that it doesn't find in the stash. So, for a
> template called "hello.tt" like this :
> 
> <body>
> <H1>[%HELLO%]</H1>
> </body>

disregarding your ideas about this would be made to work, I think
this is vaguely the kind of thing that could be made with TT2’s
Views feature. I don’t know if I’m actually on track at all,
honestly, but your description set off my neuronal associations
to Views. So I suggest you look at that and see if that can be
made to do what you want to do in a more TT2-ish way than what
you were thinking of.

Regards,
-- 
#Aristotle
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1};
&Just->another->Perl->hacker;



More information about the Catalyst mailing list