struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From PaweĊ‚ Rzepa <rz...@icslab.agh.edu.pl>
Subject Re: Tiles Internationalization with Definitions
Date Thu, 05 Jun 2003 05:49:09 GMT


Jason Lea wrote:

> Ed Smith wrote:
>
>> I want to internationalize definitions in Tiles. Consider the 
>> following definitions in a tiles
>> configuation file:
>>
>>  <definition name="layout" path="/layout.jsp">
>>     <put name="title" value="Default" />
>>     <put name="header" value="/header.jsp" />
>>  </definition>
>>
>> <definition name="index" extends="layout">
>>   <put name="title" value="Index" />
>> </definition>
>>
>> I would like to internationalize the title values.  I
>> know I can create a tiles configuration file for each
>> language; however, these files would mostly be
>> duplicates of one another with only the titles changed
>> so maintenance would be difficult.  What's the best
>> way to solve this?  Is there some way to make
>> something like the following work?
>>
>>  <definition name="layout" path="/layout.jsp">
>>     <put name="title" value=<bean:message
>> key="tile.layout">/>
>>     <put name="header" value="/header.jsp" />
>>  </definition>
>
>
> You obviously cannot put the <bean:message> tag in the tiles-defs.xml.
>
> You can probably do it this way:
>
> tiles-defs.xml:
> <definition name="layout" path="/layout.jsp">
>    <put name="title" value="tile.layout" />
>    <put name="header" value="/header.jsp" />
> </definition>
>
> <definition name="index" extends="layout">
>   <put name="title" value="index.title" />
> </definition>
>
> <definition name="otherpage" extends="layout">
>   <put name="title" value="otherpage.title" />
> </definition>
>
>
> header.jsp:
> <bean:define id="pageTitle">
>     <tiles:getAsString name="title"/>
> </bean:define>
> <head>
>     <title><bean:message name="pageTitle" /></title>
> </head>

or, to simplify:
 <tiles:importAttribute name="title"/>
...
<title><bean:message name="title"/></title>

>
>
>
> application.properties:
> index.title=Index
> otherpage.title=Other Page
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message