Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts 2 internationalization with a dynamic key

 
felipe issa
Greenhorn
Posts: 3
Chrome Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

I'm trying to internationalize an application, but I can't pass a key to the <s:text/> dynamically. Instead of recovering the value from the properties file, the key is being displayed at the page to the user.

This is my example action:



This is my TestAction.properties file:



When i pass the key directly into the JSP the struts recover the correct value..



But when i try to get the key from the java action, instead of looking for it's value it just show's the key! I've tried the followings ways to recover the text:




but none of them works.. does anyone have an idea how to solve this?

Thanks!

 
debraj mallick
Ranch Hand
Posts: 188
Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi felipe issa,

i did not understand what you are trying to do in your application,
anyway you can get the value of the key in action also, like

hope this would help you.


 
felipe issa
Greenhorn
Posts: 3
Chrome Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi debraj mallick!

That doesn't work on my case. I'll use the properties file to internationalize the application. When the user is from Us, for instance, the struts will get the value from the default file TestAction.properties. But when user is from other countries, like Brazil, struts will look for the value in the properties file 'TestAction_br.properties' for the value (or in the default file when it doesn't exists.)

But thanks for your answer anyway!
 
felipe issa
Greenhorn
Posts: 3
Chrome Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Resolved it using

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic