You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Václavík Radek <Ra...@zentiva.cz> on 2004/08/09 17:35:03 UTC

Localization within Tiles

Hi all,

(sorry for a bit longer message)

I have encountered an interesting problem. In my struts application I am
using tiles and localization through ApplicationResources.properties files.

In my jsp page I have messages written as:
<bean:message key="label.messageText"/>

however, sometimes I would like to refer to a value defined in tiles. Such
as:
<tiles:getAsString name="messageText"/>

In the tilesDefinition.xml file I have e.g.:
--snip--
	<put name="messageText" value="Hello"/>
--snip--

What I would like to do is to combine these 2 approaches and have localized
messageText without needing to rewrite it in tiles def. file. Because this
is the case in the "tiles-documentation" example supplied with tiles:
<definition.....>
	<put name="messageText" value="Bye"/>
</definition>
and in another language in tiles def. _de:
<definition.....>
	<put name="messageText" value="Tshus"/>
</definition>

But this implies a lot of (imho) unnecessary typing.


The solution I've had in mind would go something like this:
<definition ....>
	<put name="messageText" value="label.messageText"/>
</definition>

and in the jsp there would be:
<bean:message key="<tiles:getAsString name="messageText""/>

That way I would have all the localized strings in .properties files only.
But unfortunately such nesting is not possible. I have tried using scripting
variables (as I have been facing this kind of nesting problems more often)
but did not succeed.

I would appreciate any comments how to solve this issue. Thanks.

Regards,

Radek

_____________________________

Ing. Radek Václavík
ICS Department - webmaster

ZeNTIVA a.s.
U Kabelovny 130, 102 37 Praha 10
Czech Republic
tel. +420 267 243 296
_____________________________