tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Petrelli" <antonio.petre...@gmail.com>
Subject Re: How to i18n a value in tiles-defs.xml
Date Mon, 17 Sep 2007 14:53:21 GMT
2007/9/14, ext-bob.savard@nokia.com <ext-bob.savard@nokia.com>:
> Hi.
>
> I've seen lots of examples of putting together tiles definitions like
> this:
>
> <definition name="home.page>
>   <put name="title" value="this is my home page"/>
>   <put name="body" value="homepagebody.jsp"/>
> </definition>
>
> This is what I'm curious about: how do most folks internationalize the
> title value?  You can't do it programmatically in tiles-defs.xml, so
> you'd have to use some sort of mechanism akin to <bean:message
> key="..."/> in a JSP, but I'm not sure if something like that is
> available for Tiles1.


Do it this way:
<definition name="home.page">
  <put-attribute name="title" value="title.key"/>
  <put name="body" value="homepagebody.jsp"/>
</definition>

And in your JSP:

<tiles:importAttribute name="title" />
<fmt:message key="${title}" />

HTH
Antonio

Mime
View raw message