[Catalyst] Translations in Catalyst

Octavian Rasnita orasnita at gmail.com
Wed Dec 10 19:47:15 GMT 2008


From: "Keith Hasely" <groupskhasely at mac.com>
>
> Hey All,
>
> We are evaluating different frameworks to use, and one big aspect of the 
> project is how translations are handled, we deal with at least five 
> languages on a regular basis.  I am hoping to get some input on different 
> template systems, and ways you all have dealt with the multilingual issues 
> in Catalyst.  We've been using XML XSLT translations, but people in the 
> office find it challenging working with instead of an HTML template 
> system.
>
> I've seen some modules in CPAN that help with the issue such as 
> "Catalyst::Plugin::I18N" which seems to work with Template Toolkit, and 
> Pedal.  There seems to be some concern over here with the overhead HTML 
> template systems will take up compared to working with XML XSLT 
> translations.  I've also noticed the "Catalyst::View::XSLT" class which 
> means we wouldn't need to come up with a new system to get our content 
> translated before we publish.
>

I use Catalyst::Plugin::I18N and it works fine.

It is very simple to use, and I just need to use something like the text 
below for translating a certain string:

[% l("String to translate") %]

where l() is a Template-Toolkit macro:
[% MACRO l(text, args) BLOCK;c.localize(text, args);END -%]

Or you can do the translations in the program directly using:

my $translated = $c->localize("String to translate");

And the strings to translate can be kept in Gettext type of text files or in 
separate perl modules that define a hash with the string translations...

Octavian




More information about the Catalyst mailing list