Re: Internationalization of menu items using Struts-menu with struts 2
Matt Raible <matt-T7vlz3gD7BdF/EzeuO4KJwC/[email protected]> Wed, 16 Feb 2011 12:36:06 -0700
| Newsgroups | gmane.comp.java.struts-menu.user |
|---|---|
| Message-ID | <[email protected]> |
--===============5849761699415528456== Content-Type: multipart/alternative; boundary=Apple-Mail-15--397296478 --Apple-Mail-15--397296478 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 Struts Menu uses JSTL in the "el" version to resolve messages. On Feb 16, 2011, at 12:26 PM, Tiago Farias wrote: > So rude. Sorry I forgot to thank you for saving me! Thank you very = much! =3DD >=20 > 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? >=20 >=20 > 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. >=20 > <!-- 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> >=20 >=20 > On Feb 16, 2011, at 9:27 AM, Tiago Farias wrote: >=20 >> 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:=20 >>=20 >> <Displayers> >> <Displayer name=3D"Velocity" = type=3D"net.sf.navigator.displayer.VelocityMenuDisplayer"/> >> </Displayers> >> =20 >> <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>--> >> =20 >> <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"ADMIN" 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> >>=20 >> And my jsp file is this: >> <%@taglib uri=3D"http://struts-menu.sf.net/tag-el" prefix=3D"menu" %> >>=20 >> <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> >>=20 >> 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... >>=20 >> 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 >=20 >=20 > = --------------------------------------------------------------------------= ---- > 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 >=20 >=20 >=20 > = --------------------------------------------------------------------------= ---- > 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 --Apple-Mail-15--397296478 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=iso-8859-1 <html><head></head><body style=3D"word-wrap: break-word; = -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; = ">Struts Menu uses JSTL in the "el" version to resolve = messages.<div><br><div><div>On Feb 16, 2011, at 12:26 PM, Tiago Farias = wrote:</div><br class=3D"Apple-interchange-newline"><blockquote = type=3D"cite">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, Tiago Farias <span dir=3D"ltr"><<a = href=3D"mailto:[email protected]">[email protected]</a>></span> = wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; = border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Yup! = You're absolutely right. Now I'm just curious. How does that work = Matt?<div><div> </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"><<a = href=3D"mailto:matt-T7vlz3gD7BdF/EzeuO4KJwC/[email protected]" = target=3D"_blank">matt-T7vlz3gD7BdF/EzeuO4KJwC/[email protected]</a>></span> wrote:<br> <blockquote class=3D"gmail_quote" style=3D"margin: 0pt 0pt 0pt 0.8ex; = border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div = style=3D"word-wrap: break-word;">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.<div> <br></div><div><div> <!-- Define the basename for a = resource bundle for I18N --></div><div> = <context-param></div><div> = <param-name>javax.servlet.jsp.jstl.fmt.localizationContext<= /param-name></div> <div> = <param-value>ApplicationResources</param-value></div><di= v> = </context-param></div><div><br></div><div><br></div><div><div>= <div></div><div><div>On Feb 16, 2011, at 9:27 AM, Tiago Farias = wrote:</div> <br></div></div><blockquote type=3D"cite"><div><div></div><div>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: <br> <br> <Displayers><br> = <Displayer name=3D"Velocity" = type=3D"net.sf.navigator.displayer.VelocityMenuDisplayer"/><br> &n= bsp; </Displayers><br> = <br> <Menus><br> = <!-- <Menu name=3D"ecfMenu" title=3D"ECFs" = location=3D"?Contact"><br> <Item name=3D"email" = title=3D"E-Mail" location=3D"?EMail"/><br> = <Item name=3D"phone" title=3D"Phone" = location=3D"?Phone"/><br> = </Menu>--><br> <br> = <Menu name=3D"mainMenu" title=3D"" = ><br> <Item = name=3D"ecfMenu" title=3D"ECFs" roles=3D"FISCO" = location=3D"DisconnectedEcfsSearch" /><br> <Item name=3D"reportsMenu"= title=3D"Relat=F3rios" roles=3D"ADMIN" = location=3D"AlarmReportSearch"/><br> = <Item name=3D"fiscoMenu" title=3D"Fisco" = roles=3D"ADMIN" location=3D"UpdateFiscoForm"/><br> <Item name=3D"alarmMenu" = title=3D"Alarmes" roles=3D"ADMIN" = location=3D"AlarmNotification"/><br> = <Item name=3D"userMenu" = title=3D"application.header.users" roles=3D"ADMIN" = location=3D"UserSearch"/><br> <Item name=3D"consoleMenu"= title=3D"Console" roles=3D"FISCO" = location=3D"ConsoleSearch"/><br> = </Menu><br><br>And my jsp file is this:<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"menu" = %><br> <br> = <menu:useMenuDisplayer permissions=3D"rolesAdapter" name=3D"Velocity" = config=3D"/WEB-INF/tabs.html"<br> = = bundle=3D"org.apache.struts.action.MESSAGE"><br> = <menu:displayMenu name=3D"mainMenu"/><br> = </menu:useMenuDisplayer><br><br>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...<br> <br>Best regards!<br></div></div> = --------------------------------------------------------------------------= ----<br>The ultimate all-in-one performance toolkit: Intel(R) Parallel = Studio XE:<br>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> 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" = target=3D"_blank">https://lists.sourceforge.net/lists/listinfo/struts-menu= -user</a><br> = </blockquote></div><br></div></div><br>-----------------------------------= -------------------------------------------<br> The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio = XE:<br> 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" = target=3D"_blank">https://lists.sourceforge.net/lists/listinfo/struts-menu= -user</a><br> <br></blockquote></div><br> </div></div></blockquote></div><br> = --------------------------------------------------------------------------= ----<br>The ultimate all-in-one performance toolkit: Intel(R) Parallel = Studio XE:<br>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______________________________= _________________">http://p.sf.net/sfu/intel-dev2devfeb___________________= ____________________________</a><br>struts-menu-user mailing = list<br>struts-menu-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org<br>https://lists.sourceforg= e.net/lists/listinfo/struts-menu-user<br></blockquote></div><br></div></bo= dy></html>= --Apple-Mail-15--397296478-- --===============5849761699415528456== 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 --===============5849761699415528456== 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 --===============5849761699415528456==--