[Templates] i18n with Template-Toolkit

Bill Moseley moseley at hank.org
Thu Jul 17 16:24:12 BST 2008


On Thu, Jul 17, 2008 at 01:43:03AM +0200, Ayhan Ulusoy wrote:
> I use Template-Toolkit for the web and I am quite happy with it. Now,  
> I will have to come up with a way to render the template in multiple  
> languages.

I also use Locale::Maketext, but I see I have my own
failure_handler_auto() method with a note about two RT tickets (33938
and 25877).  On lookup failure I log the failure and fallback to
English.

For simple phrases I use loc( 'Text to localize' ).

When the application determines a valid language I also prefix the
INCLUDE_PATH with an additional path.  So, that will override my
default English templates.

Those language-specific directories only contain small templates with
language differences. That way I don't have to duplicate template
logic unless there's significant difference in the requirements
between languages.


-- 
Bill Moseley
moseley at hank.org
Sent from my iMutt




More information about the templates mailing list