ok, nice =) That is kinda what I would like to do. I want to have 3 images on the page and when you click on one of them the language changes to the language coresponding to the image (in other words 3 flag images).
How could I do that in an easy way on a page? Do I have to make a class or can I do it in jsp? Den 6/27/2006, skrev "C. Grobmeier" <[EMAIL PROTECTED]>: >-----BEGIN PGP SIGNED MESSAGE----- >Hash: SHA1 > >Fredrik Andersson wrote: >> Hi all >> >> I have manage to get the i18n internalization to work using the >> properties files. now I would want to be able to change the language >> through the browser (by clicking on a flag). How can I do this? >> >> Tips and pointers is appreciated =) > >I wrote a cheap setLocale-Action. Maybe not the best approach, but it >works for me. Only the "redirect to language-switched page" is ugly :-) > > > >public ActionForward execute( ActionMapping mapping, > ActionForm form, > HttpServletRequest > request, > HttpServletResponse > response) > throws Exception { > /* Switch content type*/ > String locale = request.getParameter( > ConstantsInterface.REQ_LOCALE ); > > if( locale.equalsIgnoreCase( "DE" ) ) { > setLocale( request, Locale.GERMAN ); > } > if( locale.equalsIgnoreCase( "EN") ) { > setLocale( request, Locale.ENGLISH ); > } > > > return mapping.findForward( "languageswitched" ); > } > > protected void setLocale( HttpServletRequest request, Locale locale ) { > HttpSession session = request.getSession(false); > if (session != null) { > session.setAttribute(ComponentConstants.LOCALE_KEY, locale); > } > } >-----BEGIN PGP SIGNATURE----- >Version: GnuPG v1.4.2.1 (MingW32) >Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org > >iD8DBQFEoQ9+kv8rKBUE/T4RAp7jAJ414uPD5LjtMqT7iiItgkk5dGOMEgCfe555 >WWSyqIn8w3/kWqC8UWabqps= >=5f60 >-----END PGP SIGNATURE----- > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]