You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by 林志鵬 Vincent Lin <vi...@truetel.com.tw> on 2001/06/14 05:34:52 UTC

i18n for image

I know that Struts can use "message" tag to get internationalized message to be displayed in JSP. But I have a lot of images contain words (image buttons, backgroud ... etc.). I want to show different images for different locale in JSP. Can I do it with "img" or "image" tag? And how can I do it?

Regards,
Vincent

Re: i18n for image

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Thu, 14 Jun 2001, [big5] ªL§ÓÄP  Vincent Lin wrote:

> 
> I know that Struts can use "message" tag to get internationalized
> message to be displayed in JSP. But I have a lot of images contain
> words (image buttons, backgroud ... etc.). I want to show different
> images for different locale in JSP. Can I do it with "img" or "image"
> tag? And how can I do it?
> 

There are three basic ways that the <html:img> tag can create the value
that will ultimately become the "src" attribute of the generated <img>
tag:

* Use an absolute or relative URI that is copied unmodified:

  <img src="index.html"/>

* Use a context relative path starting with "/" (Struts will prefix it
  with the context path, so that it works no matter what page is
  referring to it):

  <img page="/admin/mainMenu.jsp"/>

* Use the key to a resource that is looked up in the application
  resources, which will contain the "real" hyperlink value:

  <img pageKey="main.menu"/>

In the third case, since the message key is looked up in the
locale-specific resources, you can use different images for different
languages quite easily -- just as easily as using different field prompts
or error messages.

> Regards,
> Vincent

Craig McClanahan