Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts2: Generating list of localisation keys?

 
André-John Mas
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to be able to generate a list of localisation keys in my project. Basically I want to be able to add the key to the page and then output to file the keys. Is there any way I could do this? It would mean visiting each page in my project, but I just figured it would be simpler than copy and pasting from each page. I am using the struts 'text' tag in general:

 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Grep?
 
André-John Mas
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not really a solution, since I would still need to need to copy and paste. I am looking for all keys, no just certain ones.

I tried ActionSupport.getText(), but it does not seem to be used in all cases.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Copy and paste what? It's trivial to pull out the "name" attribute.

If it's well-formed JSP parse it as XML, then--same difference, and you'd have to write code instead of just using existing tools.

What do you mean you "tried ActionSupport.getText()"?
 
André-John Mas
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you put it that way, I suppose I could use grep.

What I meant with regards to ActionSupport.getText() is that I over-rided hoping that it would be called with the key.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's quite a few getText() signatures; you'd probably have to implement all of them (particularly if you use it from within actions as well as through the <s:text> tag). The <s:text> tag will use the first TextProvider on the value stack.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic