You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by ex...@nokia.com on 2007/09/14 23:18:35 UTC

How to i18n a value in tiles-defs.xml

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.

Any help is appreciated!
Thanks,
-Bob

Re: How to i18n a value in tiles-defs.xml

Posted by Antonio Petrelli <an...@gmail.com>.
2007/9/14, ext-bob.savard@nokia.com <ex...@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