Re: Internationalization of menu items using Struts-menu with struts 2
Matt Raible <matt-T7vlz3gD7BdF/EzeuO4KJwC/[email protected]> Wed, 16 Feb 2011 09:40:34 -0700
| Newsgroups | gmane.comp.java.struts-menu.user |
|---|---|
| Message-ID | <[email protected]> |
--===============2518910376443094168==
Content-Type: multipart/alternative; boundary=Apple-Mail-10--407828429
--Apple-Mail-10--407828429
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
charset=iso-8859-1
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:=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
--Apple-Mail-10--407828429
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; ">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>=
On Feb 16, 2011, at 9:27 AM, Tiago Farias wrote:</div><br =
class=3D"Apple-interchange-newline"><blockquote type=3D"cite">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">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>
=
--------------------------------------------------------------------------=
----<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-10--407828429--
--===============2518910376443094168==
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
--===============2518910376443094168==
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
--===============2518910376443094168==--