What about a custom JSP tag designed to replace the use of html:img tags.
The custom tag could produce a correct html:img tag as it's output, complete
with localized alt text.

-----Original Message-----
From: Howard Moore [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 15, 2001 1:21 PM
To: [EMAIL PROTECTED]
Subject: Internationalised 'alt' text


Can anybody suggest how I can add internationalised alt text to the
<html:img> tag?

If it were legal I would like to do something like the following;

<html:img src="someImage.png" alt="<bean:message
key='someImage.alt.text'/>"/>

but you can't nest tags like this.

If not does anybody think it would be useful to add an optional 'id'
attribute to the <bean:message> tag which, if set, causes the translated
message to be stored in a page context bean with the given name rather than
being written out? This would allow me to write something like;

<bean:message id="altTxt" key="someImage.alt.text"/>
<html:img src="someImage.png" alt="<%= altTxt %>"/>

It would also allow translated strings to be cached in the page if they are
going to be used repeatedly (inside a <logic:iterate> tag, for example).
This may improve performance considerably.

Any comments?

-------------------------------------------
Howard Moore
Senior Software Engineer
Datapulse CTI
Tel : +44 (0)1491 418000
Fax : +44 (0)1491 411459
E-mail: [EMAIL PROTECTED]

Reply via email to