Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

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

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

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.

M-x auto-bs-mode

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

        Yes, that's valid

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

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

      Nice! Learn something new every day...

      M-x auto-bs-mode

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://466269]
[ozboomer]: Howdy, all.. Trying this once more... Not really a perl question :(... but I don't know how to even title my query (more...)
[ozboomer]: There's a text file with lots of sections in it, like an '.ini/.conf' file. Each section can be 'used' or 'unused' by its application (more...)
[ozboomer]: Some folk want to use the text file as 'storage', keeping ALL items in it (a database); others call it an 'active document' that should only contain 'in-use' sections. Is there a 'good practice' for this sort of thing?

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2018-05-21 00:26 GMT
Find Nodes?
    Voting Booth?