GeeCON Prague 2014*
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: 316
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: 61315
    
  66

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: 61315
    
  66

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: 61315
    
  66

Example usage:

 
GeeCON Prague 2014
 
subject: i18n custom tag