You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by papinu <pl...@strategyobject.com> on 2009/02/13 15:00:07 UTC

Tiles items list i18n

I have following in tiles-defs.xml:
...
<definition name="tiles.tabs.foouser" extends="tiles.tabs">
    <put-list-attribute name="tabs">
	<item value="TAB_ACTION1" link="action1.action" />
        <item value="TAB_ACTION2" link="action2.action" />
        <item value="TAB_ACTION3" link="action3.action" />
        <item value="TAB_ACTION4" link="action4.action" />
        <item value="TAB_ACTION5" link="action5.action" />
    </put-list-attribute>
</definition>
...

Where values in 'item' element are keys in my tiles.properties file. This I
use to localize (internationalize) the tabs and menues in my Struts 2
application.
I have a troubles how to obtain a values for corresponding locale in jsp,
something like this:

<c:forEach var="item" items="${tabs}">
    <td class="maintab_back" valign="top">
	 ${item.link} 
	    <s:i18n name="com.so.was.tiles.resources.tiles" >
		<s:text name="${item.value}" /> //of course this not work, it is to
illustrate the problem
            </s:i18n>
         
    </td>
</c:forEach>

Please, help!
-- 
View this message in context: http://www.nabble.com/Tiles-items-list-i18n-tp21996903p21996903.html
Sent from the tiles users mailing list archive at Nabble.com.


Re: Tiles items list i18n

Posted by papinu <pl...@strategyobject.com>.
Thanks, Antonio.
Bye.
-- 
View this message in context: http://www.nabble.com/Tiles-items-list-i18n-tp21996903p22000137.html
Sent from the tiles users mailing list archive at Nabble.com.


Re: Tiles items list i18n

Posted by Antonio Petrelli <an...@gmail.com>.
2009/2/13 papinu <pl...@strategyobject.com>:
>
> If I use a same code that was post at the beginning I got an exception:
> According to TLD or attribute directive in tag file, attribute name does not
> accept any expressions

Right, the Struts 2 tags do not accept EL but only OGNL.
See the Struts 2 documentation to know how to move a property from a
scope to the Value Stack.
IIRC it is <s:property>. Anyway this is a Struts 2 question and you
post it there:
http://struts.apache.org/mail.html

Ciao
Antonio

Re: Tiles items list i18n

Posted by papinu <pl...@strategyobject.com>.
If I use a same code that was post at the beginning I got an exception:
According to TLD or attribute directive in tag file, attribute name does not
accept any expressions
	at
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
	at
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
	at
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
	at
org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:952)
-- 
View this message in context: http://www.nabble.com/Tiles-items-list-i18n-tp21996903p21999998.html
Sent from the tiles users mailing list archive at Nabble.com.


Re: Tiles items list i18n

Posted by Antonio Petrelli <an...@gmail.com>.
2009/2/13 papinu <pl...@strategyobject.com>:
>
> I want to take the value of the item, depending on the currently chosen
> language from a language property file and to put it in the jsp in order it
> to be rendered into html and displayed in the web page in that language.

Ok but the code that you posted should work, why do you say that "it
obviously doesn't work"? Do you see an error?
If you don't give me a clue I can't help you much.

Antonio

Re: Tiles items list i18n

Posted by papinu <pl...@strategyobject.com>.
I want to take the value of the item, depending on the currently chosen
language from a language property file and to put it in the jsp in order it
to be rendered into html and displayed in the web page in that language.
-- 
View this message in context: http://www.nabble.com/Tiles-items-list-i18n-tp21996903p21999468.html
Sent from the tiles users mailing list archive at Nabble.com.


Re: Tiles items list i18n

Posted by Antonio Petrelli <an...@gmail.com>.
2009/2/13 papinu <pl...@strategyobject.com>:
>
>
> I can't display to i18n string from my prop file.

I understand this, but what do you mean? Can't you access the keys?
The list of the keys?
The values are not properly displayed? Please elaborate on this.

Antonio

Re: Tiles items list i18n

Posted by papinu <pl...@strategyobject.com>.

I can't display to i18n string from my prop file.


Antonio Petrelli-3 wrote:
> 
> 2009/2/13 papinu <pl...@strategyobject.com>:
>> I have a troubles how to obtain a values for corresponding locale in jsp
> 
> Sorry, what kind of troubles?
> 
> Antonio
> 
> 

-- 
View this message in context: http://www.nabble.com/Tiles-items-list-i18n-tp21996903p21997682.html
Sent from the tiles users mailing list archive at Nabble.com.


Re: Tiles items list i18n

Posted by Antonio Petrelli <an...@gmail.com>.
2009/2/13 papinu <pl...@strategyobject.com>:
> I have a troubles how to obtain a values for corresponding locale in jsp

Sorry, what kind of troubles?

Antonio