[Catalyst] getting TT to translate automatically
Daniel McBrearty
danielmcbrearty at gmail.com
Sun Apr 9 14:55:57 CEST 2006
Hi
I am looking at using TT with cat to rewrite my multilanguage website.
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>
and passed a stash like this :
{ substrings = {NAME => "Pierre"},
lang => "fr",
template => "hello.tt"}
TT would then do Sitetext::get( 'fr', 'HELLO', {NAME => 'Pierre'} ),
returning "Bonjour Pierre", and substitute it (because the HELLO var was not
explicitly defined on the stash).
Can anyone tell me if this is doable in TT? I have looked but don't see an
easy way. Discussion of other neat methods used to make a multilingual
catalyst app are also welcome ...
regards
Daniel
--
Daniel McBrearty
email : danielmcbrearty at gmail.com
www.engoi.com : the multi - language vocab trainer
BTW : 0873928131
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20060409/f3f6485e/attachment.htm
More information about the Catalyst
mailing list