This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JSP and the fly likes i18n  custom tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "i18n  custom tag" Watch "i18n  custom tag" New topic
Author

i18n custom tag

peter cooke
Ranch Hand

Joined: Mar 16, 2004
Posts: 317
I am looking for a custom tag that will help me with internationalization.

I want the tag to get the bundle based on bundle name and locale. Then it should look up the key in the bundle, create a MessageFormat object, and return the result from running the format method.

Please tell me there exists some public tag that can do this common thing.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63196
    
  69

The JSTL 'fmt' class of tags does exactly what you are after.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63196
    
  69

The Jakarta implementation of the JSTL is available from the sidebar of this page.

Be sure to get the right version for your version of JSP: JSTL 1.0 for JSP 1.2, or JSTL 1.1 for JSP 2.0.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63196
    
  69

Example usage:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: i18n custom tag
 
It's not a secret anymore!