aspose file tools*
The moose likes Struts and the fly likes Struts 2 internationalization with a dynamic key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 2 internationalization with a dynamic key" Watch "Struts 2 internationalization with a dynamic key" New topic
Author

Struts 2 internationalization with a dynamic key

felipe issa
Greenhorn

Joined: Sep 26, 2011
Posts: 3

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

Joined: Mar 08, 2011
Posts: 188

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

Joined: Sep 26, 2011
Posts: 3

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

Joined: Sep 26, 2011
Posts: 3

Resolved it using

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 2 internationalization with a dynamic key