i18n taglib ver. 1.5

    Custom JSP taglib. These tags provide functionality to the internationalization your web applications. The term i18n comes from the simple fact that the word "internationalization" starts with the letter I, ends with the letter N and has 18 letters.

For example:
 


<%@ taglib uri="taglib.tld" prefix="i18n" %>

<i18n:setBundle baseName="constants" id="A" />
<i18n:getMessage id="A" key="User"/>
<i18n:getMessage id="A" key="Name"> key Name is not defined </i18n:getMessage>

in this example bundle points to files in CLASSPATH (e.g. in WEB-INF/classes) with names like constants_en.properties, constants_en_US.properties, constants_fr.properties etc.

Tags are:

setBundle

Tag loads the bundle for the provided baseName. Tag may use locale from browser preferences or directly defined by parameter. Parameters are:

1) baseName Optional parameter. Describes a base name for properties files. Default value is ApplicationResources.
2) id ID for loaded bundle
3) scope Optional parameter. Describes a scope for loaded bundle. Possible values are page, request, session or application. Default value is session.
4) locale Optional parameter. Describes a locale for bundle. Without this parameter tag uses locale from browser preferences.
5) cond Optional parameter. Describes a boolean value tag's behavior depends on. Default value is true (set bundle).

getMessage

Body tag. This tag looks up a key in the localize bundle and prints the value. Body will be executed if key is not defined. Parameters are:

1) key key for lookup
2) id ID for loaded bundle
3) scope Optional parameter. Describes a scope for loaded bundle. Possible values are page, request, session or application. Default value is session.

ifdef

Body tag. Body will be executed if key is defined in the given bundle. Parameters are:

1) key key for lookup
2) id ID for loaded bundle
3) scope Optional parameter. Describes a scope for loaded bundle. Possible values are page, request, session or application. Default value is session.

ifndef

Body tag. Body will be executed if key is not defined in the given bundle. Parameters are:

1) key key for lookup
2) id ID for loaded bundle
3) scope Optional parameter. Describes a scope for loaded bundle. Possible values are page, request, session or application. Default value is session.

for downloading:

Library: i18ntag.jar    Description: taglib.tld

© Coldbeans      Comments?

See also Coldtags suite - the largest collection of custom JSP tags.

     

Also in Coldtags: