aulusoy has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks,

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've looked at several CPAN modules such as i18n and Locale::Maketext::Simple. Both function with lexicons and both use PO files. i18n is a Perl source filter that wraps around the latter. And they seem to be very good when you deal with strings from within a Perl program.

But what about Template-Toolkit?

Would any of you know of a cool way of doing this just like i18n does for Perl? Is there a Plugin or a filter for Template-Toolkit?

I've seen a plugin Template::Multilingual, but it doesn't seem to fit my needs, because I would NOT like to write text in multiple languages in one Template file. This is not practical for transaltions and maintenance.

I would not like to fetch the strings from the database either, because this obfuscates the strings

In an ideal world, would like someting just like i18n for Template-Toolkit. The original text should reside in the template itslef while the translations would come from a PO file or something similar. There would be very little line noise in the Template file. Therefore a source filter would be good.

Would anyone know of a simple and practical solution for this? A Template-Toolkit filter perhaps?

Your help would be greatly appreciated here.

Cheers,

Ayhan (trinculo)

Replies are listed 'Best First'.
Re: i18n with Template-Toolkit
by Herkum (Parson) on Jul 16, 2008 at 00:05 UTC

    I work in a place that uses special delimiters <* KEYWORD_HERE *> to mark places it will do string substitutions for the translation. It is not a direct translation, rather it is a place holder that queries a database for what text to put in for that keyword. This is done for each language branch that we want to use the page in.

    Probably not what you wanted but I don't believe you will get effective translations with an automatic translator anyways.

Re: i18n with Template-Toolkit
by Anonymous Monk on Jul 16, 2008 at 05:49 UTC