Re: methods with parameters

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Monday, September 13, 2010, 9:00:57 AM, Flower, Martin wrote:

> Hi - in Velocity I do the following
>
> ${messageSource.getMessage("update.email.subject", null, $locale)}
>
> I have looked up and down the freemarker manuals - I know it must
> be staring me in the face, but I can't find an example of how to do
> this in Freemarker (which I would prefer).  I know I can call
> methods without parameters, for example ${locale.getDisplayLanguage()}.
>
> Any pointers ?

What's "messageSource"? Because it's not a ResourceBundle as that
doesn't have "getMessage" method.

You might find something useful here:
http://freemarker.org/docs/pgui_misc_beanwrapper.html
Look for the occurrences of ResourceBundle on this page. AFAIR it
should automatically select the messages with the locale that
corresponds to the "locale" setting of FreeMarker.

If you need something more special, then you can always write a
TemplateMethodEx implementation and put it into the data-model or
create it in an #import-ed/#include-ed library with
"com.example.MyMessageSource"?new().

-- 
Best regards,
 Daniel Dekany


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing
http://p.sf.net/sfu/novell-sfdev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.