Re: Internationalization of menu items using Struts-menu with struts 2

Tiago Farias <[email protected]> Wed, 16 Feb 2011 16:26:35 -0300
Newsgroups gmane.comp.java.struts-menu.user
Message-ID <[email protected]>
--===============6090722811784302113==
Content-Type: multipart/alternative; boundary=001636c5ab0964e468049c6b4285

--001636c5ab0964e468049c6b4285
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

So rude. Sorry I forgot to thank you for saving me! Thank you very much! =
=3DD

On Wed, Feb 16, 2011 at 4:25 PM, Tiago Farias <[email protected]> wrote:

> Yup! You're absolutely right. Now I'm just curious. How does that work
> Matt?
>
>
> On Wed, Feb 16, 2011 at 1:40 PM, Matt Raible <matt-T7vlz3gD7BdF/EzeuO4KJwC/[email protected]>wrot=
e:
>
>> If you remove the bundle attribute and add the following to your web.xml=
,
>> it should work. The param name is the name of your properties file in
>> WEB-INF/classes, without the .properties extension.
>>
>>     <!-- Define the basename for a resource bundle for I18N -->
>>     <context-param>
>>
>>  <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
>>         <param-value>ApplicationResources</param-value>
>>     </context-param>
>>
>>
>> On Feb 16, 2011, at 9:27 AM, Tiago Farias wrote:
>>
>> Hello, I'm trying to make a custom menu for a web app and it all worked
>> just fine, but now I need to internationalize it using a properties file=
.
>> This properties file already exists and the whole app uses it. My
>> menu-config.xml is this:
>>
>>    <Displayers>
>>          <Displayer name=3D"Velocity"
>> type=3D"net.sf.navigator.displayer.VelocityMenuDisplayer"/>
>>     </Displayers>
>>
>>     <Menus>
>>         <!--  <Menu name=3D"ecfMenu" title=3D"ECFs" location=3D"?Contact=
">
>>           <Item name=3D"email" title=3D"E-Mail" location=3D"?EMail"/>
>>           <Item name=3D"phone" title=3D"Phone" location=3D"?Phone"/>
>>         </Menu>-->
>>
>>         <Menu name=3D"mainMenu" title=3D"" >
>>           <Item name=3D"ecfMenu" title=3D"ECFs" roles=3D"FISCO"
>> location=3D"DisconnectedEcfsSearch" />
>>           <Item name=3D"reportsMenu" title=3D"Relat=F3rios" roles=3D"ADM=
IN"
>> location=3D"AlarmReportSearch"/>
>>           <Item name=3D"fiscoMenu" title=3D"Fisco" roles=3D"ADMIN"
>> location=3D"UpdateFiscoForm"/>
>>           <Item name=3D"alarmMenu" title=3D"Alarmes" roles=3D"ADMIN"
>> location=3D"AlarmNotification"/>
>>           <Item name=3D"userMenu" title=3D"application.header.users"
>> roles=3D"ADMIN" location=3D"UserSearch"/>
>>           <Item name=3D"consoleMenu" title=3D"Console" roles=3D"FISCO"
>> location=3D"ConsoleSearch"/>
>>         </Menu>
>>
>> And my jsp file is this:
>> <%@taglib uri=3D"http://struts-menu.sf.net/tag-el" prefix=3D"menu" %>
>>
>>            <menu:useMenuDisplayer permissions=3D"rolesAdapter"
>> name=3D"Velocity" config=3D"/WEB-INF/tabs.html"
>>                 bundle=3D"org.apache.struts.action.MESSAGE">
>>                 <menu:displayMenu name=3D"mainMenu"/>
>>             </menu:useMenuDisplayer>
>>
>> The thing is that all the menu titles are ok except for the "userMenu"
>> title that is displaying the key to the properties file
>> (application.header.users). I wanted it to get the i18n file and display=
 the
>> value associated with this key. I'm using struts2 and all the tutorials =
I
>> found for this are Struts1's. Need help! Don't know what else to do...
>>
>> Best regards!
>>
>> ------------------------------------------------------------------------=
------
>> The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE=
:
>> Pinpoint memory and threading errors before they happen.
>> Find and fix more than 250 security defects in the development cycle.
>> Locate bottlenecks in serial and parallel code that limit performance.
>>
>> http://p.sf.net/sfu/intel-dev2devfeb____________________________________=
___________
>> struts-menu-user mailing list
>> struts-menu-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
>> https://lists.sourceforge.net/lists/listinfo/struts-menu-user
>>
>>
>>
>>
>> ------------------------------------------------------------------------=
------
>> The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE=
:
>> Pinpoint memory and threading errors before they happen.
>> Find and fix more than 250 security defects in the development cycle.
>> Locate bottlenecks in serial and parallel code that limit performance.
>> http://p.sf.net/sfu/intel-dev2devfeb
>> _______________________________________________
>> struts-menu-user mailing list
>> struts-menu-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
>> https://lists.sourceforge.net/lists/listinfo/struts-menu-user
>>
>>
>

--001636c5ab0964e468049c6b4285
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

So rude. Sorry I forgot to thank you for saving me! Thank you very much! =
=3DD<br><br><div class=3D"gmail_quote">On Wed, Feb 16, 2011 at 4:25 PM, Tia=
go Farias <span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]">aerob=
[email protected]</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; borde=
r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Yup! You&#39;re a=
bsolutely right. Now I&#39;m just curious. How does that work Matt?<div><di=
v>
</div><div class=3D"h5"><br><br><div class=3D"gmail_quote">On Wed, Feb 16, =
2011 at 1:40 PM, Matt Raible <span dir=3D"ltr">&lt;<a href=3D"mailto:matt@r=
aibledesigns.com" target=3D"_blank">matt-T7vlz3gD7BdF/EzeuO4KJwC/[email protected]</a>&gt;</span> w=
rote:<br>

<blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; borde=
r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div style=3D"wor=
d-wrap: break-word;">If you remove the bundle attribute and add the followi=
ng to your web.xml, it should work. The param name is the name of your prop=
erties file in WEB-INF/classes, without the .properties extension.<div>

<br></div><div><div>=A0=A0 =A0&lt;!-- Define the basename for a resource bu=
ndle for I18N --&gt;</div><div>=A0=A0 =A0&lt;context-param&gt;</div><div>=
=A0=A0 =A0 =A0 =A0&lt;param-name&gt;javax.servlet.jsp.jstl.fmt.localization=
Context&lt;/param-name&gt;</div>

<div>=A0=A0 =A0 =A0 =A0&lt;param-value&gt;ApplicationResources&lt;/param-va=
lue&gt;</div><div>=A0=A0 =A0&lt;/context-param&gt;</div><div><br></div><div=
><br></div><div><div><div></div><div><div>On Feb 16, 2011, at 9:27 AM, Tiag=
o Farias wrote:</div>

<br></div></div><blockquote type=3D"cite"><div><div></div><div>Hello, I&#39=
;m trying to make a custom menu for a web app and it all worked just fine, =
but now I need to internationalize it using a properties file. This propert=
ies file already exists and the whole app uses it. My menu-config.xml is th=
is: <br>


<br>=A0=A0 &lt;Displayers&gt;<br>=A0=A0=A0 =A0=A0=A0 =A0&lt;Displayer name=
=3D&quot;Velocity&quot; type=3D&quot;net.sf.navigator.displayer.VelocityMen=
uDisplayer&quot;/&gt;<br>=A0=A0=A0 &lt;/Displayers&gt;<br>=A0=A0=A0 <br>=A0=
=A0=A0 &lt;Menus&gt;<br>=A0=A0=A0 =A0=A0=A0 &lt;!--=A0 &lt;Menu name=3D&quo=
t;ecfMenu&quot; title=3D&quot;ECFs&quot; location=3D&quot;?Contact&quot;&gt=
;<br>


=A0=A0=A0 =A0=A0=A0 =A0 &lt;Item name=3D&quot;email&quot; title=3D&quot;E-M=
ail&quot; location=3D&quot;?EMail&quot;/&gt;<br>=A0=A0=A0 =A0=A0=A0 =A0 &lt=
;Item name=3D&quot;phone&quot; title=3D&quot;Phone&quot; location=3D&quot;?=
Phone&quot;/&gt;<br>=A0=A0=A0 =A0=A0=A0 &lt;/Menu&gt;--&gt;<br>


=A0=A0=A0 =A0=A0=A0 <br>=A0=A0=A0 =A0=A0=A0 &lt;Menu name=3D&quot;mainMenu&=
quot; title=3D&quot;&quot; &gt;<br>=A0=A0=A0 =A0=A0=A0 =A0 &lt;Item name=3D=
&quot;ecfMenu&quot; title=3D&quot;ECFs&quot; roles=3D&quot;FISCO&quot; loca=
tion=3D&quot;DisconnectedEcfsSearch&quot; /&gt;<br>


=A0=A0=A0 =A0=A0=A0 =A0 &lt;Item name=3D&quot;reportsMenu&quot; title=3D&qu=
ot;Relat=F3rios&quot; roles=3D&quot;ADMIN&quot; location=3D&quot;AlarmRepor=
tSearch&quot;/&gt;<br>=A0=A0=A0 =A0=A0=A0 =A0 &lt;Item name=3D&quot;fiscoMe=
nu&quot; title=3D&quot;Fisco&quot; roles=3D&quot;ADMIN&quot; location=3D&qu=
ot;UpdateFiscoForm&quot;/&gt;<br>


=A0=A0=A0 =A0=A0=A0 =A0 &lt;Item name=3D&quot;alarmMenu&quot; title=3D&quot=
;Alarmes&quot; roles=3D&quot;ADMIN&quot; location=3D&quot;AlarmNotification=
&quot;/&gt;<br>=A0=A0=A0 =A0=A0=A0 =A0 &lt;Item name=3D&quot;userMenu&quot;=
 title=3D&quot;application.header.users&quot; roles=3D&quot;ADMIN&quot; loc=
ation=3D&quot;UserSearch&quot;/&gt;<br>


=A0=A0=A0 =A0=A0=A0 =A0 &lt;Item name=3D&quot;consoleMenu&quot; title=3D&qu=
ot;Console&quot; roles=3D&quot;FISCO&quot; location=3D&quot;ConsoleSearch&q=
uot;/&gt;<br>=A0=A0=A0 =A0=A0=A0 &lt;/Menu&gt;<br><br>And my jsp file is th=
is:<br>&lt;%@taglib uri=3D&quot;<a href=3D"http://struts-menu.sf.net/tag-el=
" target=3D"_blank">http://struts-menu.sf.net/tag-el</a>&quot; prefix=3D&qu=
ot;menu&quot; %&gt;<br>


<br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 &lt;menu:useMenuDisplayer permissions=3D=
&quot;rolesAdapter&quot; name=3D&quot;Velocity&quot; config=3D&quot;/WEB-IN=
F/tabs.html&quot;<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 bundle=3D&quot=
;org.apache.struts.action.MESSAGE&quot;&gt;<br>

=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 &lt;menu:displayMenu name=3D&quot;m=
ainMenu&quot;/&gt;<br>
=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 &lt;/menu:useMenuDisplayer&gt;<br><br>The thi=
ng is that all the menu titles are ok except for the &quot;userMenu&quot; t=
itle that is displaying the key to the properties file (application.header.=
users). I wanted it to get the i18n file and display the value associated w=
ith this key. I&#39;m using struts2 and all the tutorials I found for this =
are Struts1&#39;s. Need help! Don&#39;t know what else to do...<br>


<br>Best regards!<br></div></div>
---------------------------------------------------------------------------=
---<br>The ultimate all-in-one performance toolkit: Intel(R) Parallel Studi=
o XE:<br>Pinpoint memory and threading errors before they happen.<br>Find a=
nd fix more than 250 security defects in the development cycle.<br>

Locate bottlenecks in serial and parallel code that limit performance.<br><=
a href=3D"http://p.sf.net/sfu/intel-dev2devfeb_____________________________=
__________________" target=3D"_blank">http://p.sf.net/sfu/intel-dev2devfeb_=
______________________________________________</a><br>

struts-menu-user mailing list<br><a href=3D"mailto:[email protected]=
ourceforge.net" target=3D"_blank">struts-menu-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org</a=
><br><a href=3D"https://lists.sourceforge.net/lists/listinfo/struts-menu-us=
er" target=3D"_blank">https://lists.sourceforge.net/lists/listinfo/struts-m=
enu-user</a><br>

</blockquote></div><br></div></div><br>------------------------------------=
------------------------------------------<br>
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:<b=
r>
Pinpoint memory and threading errors before they happen.<br>
Find and fix more than 250 security defects in the development cycle.<br>
Locate bottlenecks in serial and parallel code that limit performance.<br>
<a href=3D"http://p.sf.net/sfu/intel-dev2devfeb" target=3D"_blank">http://p=
.sf.net/sfu/intel-dev2devfeb</a><br>_______________________________________=
________<br>
struts-menu-user mailing list<br>
<a href=3D"mailto:struts-menu-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org" target=3D"_blank"=
>struts-menu-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org</a><br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/struts-menu-user" t=
arget=3D"_blank">https://lists.sourceforge.net/lists/listinfo/struts-menu-u=
ser</a><br>
<br></blockquote></div><br>
</div></div></blockquote></div><br>

--001636c5ab0964e468049c6b4285--


--===============6090722811784302113==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
--===============6090722811784302113==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
struts-menu-user mailing list
struts-menu-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/struts-menu-user

--===============6090722811784302113==--