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

Matt Raible <matt-T7vlz3gD7BdF/EzeuO4KJwC/[email protected]> Tue, 12 Jul 2011 10:50:14 -0600
Newsgroups gmane.comp.java.struts-menu.user
Message-ID <[email protected]>
What are you using to try and switch the locale? Are you able to switch the=
 locale for the rest of your messages?

On Jul 12, 2011, at 10:46 AM, yvan khekhone wrote:

> =

> hi =

> i have the same configuration with struts2 and Struts menu i cannot switch
> language.
> i show my code =

> =

> on my struts menu
> =

> <?xml version=3D"1.0" encoding=3D"UTF-8"?>
> <MenuConfig>
>    <Displayers>
> =

> =

> <Displayer name=3D"TabbedMenu"
>  type=3D"net.sf.navigator.displayer.TabbedMenuDisplayer"/>
>     </Displayers>
> <Menus> =

> <Menu name=3D"Global.Home" title=3D"Home"  page=3D"totoAction.action"  /> =

>  <Menu name=3D"Global.About" title=3D"About"  page=3D"modification.action=
" />
>  <Menu name=3D"Global.About" title=3D"animaux"  page=3D"animal.action" />
>  </Menus>
> =

> </MenuConfig>
> =

> on my jsp page.
> =

> <%@ page language=3D"java" contentType=3D"text/html; charset=3DISO-8859-1"
>    pageEncoding=3D"ISO-8859-1"%>
>     <%@ taglib prefix=3D"s" uri=3D"/struts-tags" %>
>     <%@ taglib prefix=3D"sx" uri=3D"/struts-dojo-tags" %>
>     <%@ taglib prefix=3D"menu" uri=3D"http://struts-menu.sf.net/tag-el"%>
> =

> <html>
>  <head>
> =

>  </head>
>  <body>
> =

>    <h1 class=3D'title'>SiteMesh example site: <sitemesh:write
> property=3D'title'/></h1>
> <div>
> <div id=3D"menu" class=3D"menu">
> <menu:useMenuDisplayer name=3D"TabbedMenu"
>  bundle=3D"Global" >
>  <menu:displayMenu name=3D"Global.Home" />
>  <menu:displayMenu name=3D"Global.About" />
> </menu:useMenuDisplayer>
> </div>
>    <div class=3D'mainBody'>
>      <sitemesh:write property=3D'body'/>
>    </div>
> </div>
>    <div class=3D'disclaimer'>Site disclaimer. This is an example.</div>
> =

>  </body>
> </html>
> i put attribut but its not working too :/
> =

> =

> mraible wrote:
>> =

>> 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
>>> =

>>> On Wed, Feb 16, 2011 at 4:25 PM, Tiago Farias <[email protected]> wrot=
e:
>>> 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.xm=
l,
>>> 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"?Contac=
t">
>>>>          <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"AD=
MIN"
>>>> 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 displ=
ay
>>>> 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 X=
E:
>>> 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 X=
E:
>>> 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
>> =

>> =

> =

> -- =

> View this message in context: http://old.nabble.com/Internationalization-=
of-menu-items-using-Struts-menu-with-struts-2-tp30942065p32047366.html
> Sent from the struts-menu-user mailing list archive at Nabble.com.
> =

> =

> -------------------------------------------------------------------------=
-----
> AppSumo Presents a FREE Video for the SourceForge Community by Eric =

> Ries, the creator of the Lean Startup Methodology on "Lean Startup =

> Secrets Revealed." This video shows you how to validate your ideas, =

> optimize your ideas and identify your business strategy.
> http://p.sf.net/sfu/appsumosfdev2dev
> _______________________________________________
> struts-menu-user mailing list
> struts-menu-user-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/struts-menu-user


---------------------------------------------------------------------------=
---
AppSumo Presents a FREE Video for the SourceForge Community by Eric =

Ries, the creator of the Lean Startup Methodology on "Lean Startup =

Secrets Revealed." This video shows you how to validate your ideas, =

optimize your ideas and identify your business strategy.
http://p.sf.net/sfu/appsumosfdev2dev