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)


In reply to i18n with Template-Toolkit by aulusoy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.