Trying to localize catalyst template

126 views Asked by At

I'm having a hell of a time trying to localize a catalyst template. I'm using Catalyst::Plugin::I18N

I have my de.po file set.

In my controller I have:

$c->languages( ['de'] );
$c->stash(template => 'MY_TEMPLATE.tt');

However, I have no idea how to call localize on this. Any help would be greatly appreciated.

1

There are 1 answers

0
Fotis_zzz On

Once you have already set the .po file $c->languages( ['de'] ); is not needed. In controller :

$c->stash(template => 'MY_TEMPLATE.tt');

In template :

[% Catalyst.localize(text) %]

The text that put in localize() is the msgid text in your de.po