http://www.perlmonks.org?node_id=466232


in reply to Template::Toolkit, look-and-feel and internationalization

We set up the language translation recently with TT -- here's how we did it (I'm not by any means claiming this is _THE_ way to do it.. not good or bad, just A way) (also, this wasn't too exciting because it was just for english-US vs english-UK): I'm sure there's lots of pros and cons to be gleaned from the above, but keep in mind it was made for our more limited case..

Replies are listed 'Best First'.
Re^2: Template::Toolkit, look-and-feel and internationalization
by lachoy (Parson) on Jun 13, 2005 at 20:01 UTC

    How does the FILTER usage work when you've got to pass parameters?

    I've implemented something similar to this in OpenInteract2 -- you just call:

    [% MSG( 'somekey', param1, param2, ... ) %]

    ...and that call gets replaced by the relevant lookup and replacement. Behind the scenes it's using Locale::Maketext, but that detail is irrelevant to the template creator.

    Chris
    M-x auto-bs-mode

      It's built to handle things like [% FILTER repeat(3) %]blah [% END %] -- Two starting points (with some good examples) are the FILTER directive and the Template::Filters docs.
        Just a little question... I saw that the | can be used for an alias to FILTER, but I didn't understood if this only applies to non-block directive... And if it's valid to remove the whitespaces... would the following be valid?
        • [%|i18n%]Text to be translated[%END%]
        • [%|i18n(10)%]You gained %d experience points[%END%]

        P.S.: Is there an alias for [%END%]?

        daniel

        Nice! Learn something new every day...

        Chris
        M-x auto-bs-mode