[Catalyst] getting TT to translate automatically

Daniel McBrearty danielmcbrearty at gmail.com
Sun Apr 9 22:11:14 CEST 2006


even simpler  - just define a very basic plugin:

<module code>
package Catalyst::Plugin::TTL10n;

use strict;
use warnings;

our $VERSION = 0.01;

sub l10n {
    my ($c, $key) = @_;
    my $lang = $c->{stash}{lang};
    $c->log->debug("l10n - lang : $lang, key : $key");
    return Sitetext::get($key, $lang); # or whatever your version of this is
}

1;

and in the template ... :

<body>
[% c.l10n('some text that needs translation') %]
</body>


(ATATMFWTDI ... ;)

cheers

--
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/a1721da8/attachment-0001.htm 


More information about the Catalyst mailing list