Beefy Boxes and Bandwidth Generously Provided by pair Networks Ovid
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Template::Toolkit, look-and-feel and internationalization

by lachoy (Parson)
on Jun 13, 2005 at 16:01 UTC ( [id://466269]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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

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

Replies are listed 'Best First'.
Re^3: Template::Toolkit, look-and-feel and internationalization
by davidrw (Prior) on Jun 13, 2005 at 20:13 UTC
    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.

      Nice! Learn something new every day...

      Chris
      M-x auto-bs-mode

      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
        <EDIT>
        Yes, that's valid
        </EDIT>

        Changing that to:
        [% "Text to be translated" | i18n %]
        and
        [% "You gained %d experience points" | i18n(10) %]

        respectively, would eliminate the need for the [%END%] tag. I also find this more readable.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://466269]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.