struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Treadway" <atread...@Quinstreet.com>
Subject RE: Internationalization of an existing struts/tiles project
Date Mon, 19 Apr 2004 16:09:16 GMT
Hi Chris,

One approach would be to specify a key to use in the tile definition rather than the actual
text to use as the title.

So in your tiles-defs.xml you have:

  <put name="pageTitleKey" value="title.somepagekey" />

In your JSP you have something like:

  <tiles:importAttribute name="pageTitleKey"/>
  <bean:message key="${pageTitleKey}"/>

In your resource bundles:

  title.somepagekey=Some Page Title


Using this approach you add a layer of indirection between you tile-definition and the text
used for the title of the page :-)

This approach can also be extended to allow per-page/view configuration of individual tiles
to enable re-use of the same JSP across a whole webapp, where the presentation of that tile
is dependant upon the context (view) within which it appears - but that's another thread...

Cheers,
Alan Treadway

> -----Original Message-----
> From: Chris Searle [mailto:chris@empolis.no]
> Sent: 19 April 2004 16:29
> To: struts-user@jakarta.apache.org
> Subject: Internationalization of an existing struts/tiles project
> 
> 
> 
> I've got an existing struts/tiles project which needs making locale
> aware. This is going well (due to the framework support for it) and is
> mostly complete but there is one thing I can't decide on how best to
> do.
> 
> For each tile definition the page title has been set with via tiles
> (in the tiles-defs.xml) with a:
> 
>     <put name="page.title" value="text value of the title" />
> 
> and this is overwritten in all descendent tile definitions.
> 
> Then in the jsp we have
> 
>   <tiles:getAsString name="page.title"/>
> 
> I see that it is possible to have separate tiles-defs.xml per language
> - but - the only difference will be the page.title settings - is it
> not possible to get to the values in the language dependent
> .properties files from within a single tiles-defs.xml file?
> 
> Given the starting situation - what is the best way to
> internationalize these titles?
> 
> Regards
> 
> -- 
> Chris Searle
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

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


Mime
View raw message