wood burning stoves 2.0*
The moose likes Struts and the fly likes struts2: Generating list of localisation keys? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "struts2: Generating list of localisation keys?" Watch "struts2: Generating list of localisation keys?" New topic
Author

struts2: Generating list of localisation keys?

André-John Mas
Ranch Hand

Joined: Oct 18, 2008
Posts: 37
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

Joined: Sep 29, 2008
Posts: 12617

Grep?
André-John Mas
Ranch Hand

Joined: Oct 18, 2008
Posts: 37
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

Joined: Sep 29, 2008
Posts: 12617

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

Joined: Oct 18, 2008
Posts: 37
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

Joined: Sep 29, 2008
Posts: 12617

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: struts2: Generating list of localisation keys?
 
Similar Threads
What is retuned, what am i checking
sort the values in a HashMap withOut using a Comparator
Is it possible to use List<java Object> and bind it to my rich:tree rather than List<Sring>?
is it possible to have a pop up button in my jsp wrapper without js?
Is localisation using resource bundles allowed at all?