look at the bean:message tag:

<bean:message key="title"/>

johan


> -----Original Message-----
> From: Gregor Rayman [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 30, 2001 2:12 PM
> To: [EMAIL PROTECTED]
> Subject: template and I18N
> 
> 
> Hi all, 
> 
> I've just started to use Struts and I have some questions:
> 
> 
> 1. How can I use the I18N features in the template tags?
> 
> In my template.jsp I've got the following tag:
> 
> <title><template:get name='title'/></title>
> 
> In the page using this teplate the following:
> 
> <template:put name='title' content='Kalkulation' direct='true'/>
> 
> I'd like to replace the German text 'Kalkulation' with its
> key e.g. 'app.title.calculation' Is there a nice way to do this?
> 
> 
> 
> 2. How can I use use the I18N features in Struts directly
> in Java Scriplets? 
> 
> Sometimes I need the translated texts in scriplets. What is 
> the best way to access them?
> 
> Now I am using this aproach:
> 
> <%
> 
>   MessageResources resources =
>     (MessageResources) pageContext.getAttribute(
>         Action.MESSAGES_KEY, PageContext.APPLICATION_SCOPE);
> 
>   Locale locale = 
>     (Locale) pageContext.getAttribute(
>        Action.LOCALE_KEY, PageContext.SESSION_SCOPE);
> 
>   if (null == locale) {
>     locale = request.getLocale();
>   }
> 
>   String myText = resources.getMessage(locale, "app.the.text,key");
> 
> %>
> 
> Thanks for an answer
> 
> --
> gR
> 
> 
> 
> 
> 

Reply via email to