tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Kerwick <David.Kerw...@hse.ie>
Subject Struts2 + Tiles + i18n, getText issue
Date Wed, 11 Feb 2009 09:53:20 GMT
I tried asking this of the struts list but got no response I was wondering of anyone here
could help.

The problem I have is these two statements give different results when the language is changed
<s:property value="%{getText('test')}"/> <s:text name="test"/> when in a tile.

With s:text giving the correct language text but getText always gives the default language

The tiles definition I have is

<definition name="test.basic" template="/WEB-INF/tiles/testTemplate.jsp"> 
      <put-attribute name="body"   value="/test.jsp"/>
      <put-attribute name="navbar" value="/WEB-INF/pages/navBar.jsp"/>

They both work correctly if there's only one tile i.e.

<definition name="test.basic" template="/WEB-INF/tiles/testTemplate.jsp"> 
      <put-attribute name="body"   value="/test.jsp"/>

So it seems to be something to do with having multiple tiles but since s:text works I would
have thought the i18n interceptor must be working. 
Anyone any idea why getText is ignoring the language?
This happened for me when trying to localise labels i.e.

<s:textfield key="surname" label="%{getText('surname')}"></s:textfield>

I can get languages to work if I pass the body tile through an action i.e.
<put-attribute name="body"   value="/test.action"/>
But that creates a whole set of other problems for me with validation.

I'm using Struts struts-2.0.14 and the tiles bundle that comes with it, I have also tried
I change language using the code from HelloWorld.action

        <s:url id="url" action="test">
            <s:param name="request_locale">en</s:param>
        <s:a href="%{url}">English</s:a>
        <s:url id="url" action="test">
            <s:param name="request_locale">ga</s:param>
        <s:a href="%{url}">Irish</s:a>

Am I just doing something wrong?  If so what should I be doing?

Any help would be great

View raw message