Re: Internationalization of menu items using Struts-menu with struts 2
Tiago Farias <[email protected]> Wed, 16 Feb 2011 16:25:34 -0300
| Newsgroups | gmane.comp.java.struts-menu.user |
|---|---|
| Message-ID | <[email protected]> |
--===============1558644555739640707== Content-Type: multipart/alternative; boundary=001636c5a2d6b0c24a049c6b3efe --001636c5a2d6b0c24a049c6b3efe Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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]> wrote= : > 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"ADMI= N" > 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 > > --001636c5a2d6b0c24a049c6b3efe Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Yup! You're absolutely right. Now I'm just curious. How does that w= ork Matt?<br><br><div class=3D"gmail_quote">On Wed, Feb 16, 2011 at 1:40 PM= , Matt Raible <span dir=3D"ltr"><<a href=3D"mailto:matt-T7vlz3gD7BdF/[email protected]= m">matt-T7vlz3gD7BdF/EzeuO4KJwC/[email protected]</a>></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;"><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<!-- Define the basename for a resource bu= ndle for I18N --></div><div>=A0=A0 =A0<context-param></div><div>= =A0=A0 =A0 =A0 =A0<param-name>javax.servlet.jsp.jstl.fmt.localization= Context</param-name></div> <div>=A0=A0 =A0 =A0 =A0<param-value>ApplicationResources</param-va= lue></div><div>=A0=A0 =A0</context-param></div><div><br></div><div= ><br></div><div><div><div></div><div class=3D"h5"><div>On Feb 16, 2011, at = 9:27 AM, Tiago Farias wrote:</div> <br></div></div><blockquote type=3D"cite"><div><div></div><div class=3D"h5"= >Hello, I'm trying to make a custom menu for a web app and it all worke= d 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-con= fig.xml is this: <br> <br>=A0=A0 <Displayers><br>=A0=A0=A0 =A0=A0=A0 =A0<Displayer name= =3D"Velocity" type=3D"net.sf.navigator.displayer.VelocityMen= uDisplayer"/><br>=A0=A0=A0 </Displayers><br>=A0=A0=A0 <br>=A0= =A0=A0 <Menus><br>=A0=A0=A0 =A0=A0=A0 <!--=A0 <Menu name=3D&quo= t;ecfMenu" title=3D"ECFs" location=3D"?Contact">= ;<br> =A0=A0=A0 =A0=A0=A0 =A0 <Item name=3D"email" title=3D"E-M= ail" location=3D"?EMail"/><br>=A0=A0=A0 =A0=A0=A0 =A0 <= ;Item name=3D"phone" title=3D"Phone" location=3D"?= Phone"/><br>=A0=A0=A0 =A0=A0=A0 </Menu>--><br> =A0=A0=A0 =A0=A0=A0 <br>=A0=A0=A0 =A0=A0=A0 <Menu name=3D"mainMenu&= quot; title=3D"" ><br>=A0=A0=A0 =A0=A0=A0 =A0 <Item name=3D= "ecfMenu" title=3D"ECFs" roles=3D"FISCO" loca= tion=3D"DisconnectedEcfsSearch" /><br> =A0=A0=A0 =A0=A0=A0 =A0 <Item name=3D"reportsMenu" title=3D&qu= ot;Relat=F3rios" roles=3D"ADMIN" location=3D"AlarmRepor= tSearch"/><br>=A0=A0=A0 =A0=A0=A0 =A0 <Item name=3D"fiscoMe= nu" title=3D"Fisco" roles=3D"ADMIN" location=3D&qu= ot;UpdateFiscoForm"/><br> =A0=A0=A0 =A0=A0=A0 =A0 <Item name=3D"alarmMenu" title=3D"= ;Alarmes" roles=3D"ADMIN" location=3D"AlarmNotification= "/><br>=A0=A0=A0 =A0=A0=A0 =A0 <Item name=3D"userMenu"= title=3D"application.header.users" roles=3D"ADMIN" loc= ation=3D"UserSearch"/><br> =A0=A0=A0 =A0=A0=A0 =A0 <Item name=3D"consoleMenu" title=3D&qu= ot;Console" roles=3D"FISCO" location=3D"ConsoleSearch&q= uot;/><br>=A0=A0=A0 =A0=A0=A0 </Menu><br><br>And my jsp file is th= is:<br><%@taglib uri=3D"<a href=3D"http://struts-menu.sf.net/tag-el= " target=3D"_blank">http://struts-menu.sf.net/tag-el</a>" prefix=3D&qu= ot;menu" %><br> <br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 <menu:useMenuDisplayer permissions=3D= "rolesAdapter" name=3D"Velocity" config=3D"/WEB-IN= F/tabs.html"<br>=A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 bundle=3D"= ;org.apache.struts.action.MESSAGE"><br> =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 <menu:displayMenu name=3D"m= ainMenu"/><br> =A0=A0=A0 =A0=A0=A0 =A0=A0=A0 </menu:useMenuDisplayer><br><br>The thi= ng is that all the menu titles are ok except for the "userMenu" 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'm using struts2 and all the tutorials I found for this = are Struts1's. Need help! Don'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">struts-menu-user@= lists.sourceforge.net</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> --001636c5a2d6b0c24a049c6b3efe-- --===============1558644555739640707== 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 --===============1558644555739640707== 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 --===============1558644555739640707==--