You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sean Dockery <us...@sbdconsultants.com> on 2003/10/12 21:14:03 UTC

Tiles - Localization possible through tiles-def?

I am relatively new to Tiles, so forgive me if there's a simple solution to
this...

I came across the following situation:

tiles-defs.xml:
<tiles-definitions>
    <definition name=".default.layout" path="/WEB-INF/jsp/Default.jsp">
        <put name="title" value="Unknown"/>
    </definition>
    <definition name=".welcome.layout" extends=".default.layout">
        <put name="title" value="Welcome"/>
    </definition>
</tiles-definitions>

Default.jsp:
<%@ taglib uri="/struts/tiles.tld" prefix="tiles"%>
<html>
    <head>
        <title><tiles:getAsString name="title"/></title>
    </head>
    <body>
        <h1><tiles:getAsString name="title"/></h1>
    </body>
</html>

I can't think of a way to _directly_ localize on tiles:getAsString, so I was
wondering what is the recommended approach?  Of course, I could put a
<bean:message key="welcome"/> in a JSP and use <tiles:get name="title"/> to
fetch it.  Is the use of tiles:getAsString disrecommended anywhere for
internationalized applications?  If not, should it be?

Here's an idea:  What if the put element supported a key attribute (mutually
exclusive to the value attribute) to fetch values from a resource bundle.
Comments?





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