[Opensource] If not logged in users want to set their Locale

Mike Traum mtraum at cirnetwork.org
Wed Apr 16 17:03:42 PDT 2003


I see now. I assume you realize that the amount of memory should be
insignificant unless your site is handling a HUGE (minimum of 1000's of
simultaneous users) number of visitors.

That being said, you could modify struts to achieve this, but I would have
to guess that would be a bad way to go. Possibly a better way would be to
use jakarta's I18N Tag Library
(http://jakarta.apache.org/taglibs/doc/i18n-doc/intro.html). As far as I
know, it doesn't have ANY built in mechanish for keeping track of the
current user's locale. So, you could:
- set a cookie when a locale is chosen
- retrieve the cookie on every page
- set the locale for the I18N taglib using <i18n:locale>
- use the <i18n:bundle> to display messages

hth,
mike


     -----Original Message-----
     From: Lirian Ostrovica [mailto:lirian.ostrovica at senecac.on.ca]
     Sent: Wednesday, April 16, 2003 8:16 AM
     To: opensource at jcorporate.com
     Subject: Re: [Opensource] If not logged in users want to set their
     Locale
     
     
     Hi Mike,
     I'm afraid you did not understand me (or I was not clear).
     I do not want to create a user session only for the sake of i18n.
     
     A number of visitors of a site, can come as anonymous (not 
     logged in). They
     will browse throw the pages that they can, and then simply leave.
     It is quite normal that the number of such visitors be 
     well compared, or even
     bigger than the number of 'logged in' ones.
     In such a case, creating  sessions for anonymous visitors 
     will be a real waste
     of memory.
     
     That's why, as I said, the solution are cookies, with some 
     sort of URL
     rewriting as a backup.
     I have seen this recently discusses in Struts user list too.
     
     Lirian
     
     
     
     Mike Traum wrote:
     
     > We do it here by setting the session attribute 
     "expresso.LOCALE", the same
     > one that expresso uses. Works great!
     >
     > Did you not want to use cookies? You have to have 
     something to remember
     > state info if you want to use Struts/Expresso-sytle 
     i18n. In this case, the
     > session is used - which gives you the option of using 
     cookies or the
     > jsession querystring parameter.
     >
     > mike
     >
     >      -----Original Message-----
     >      From: Lirian Ostrovica 
[mailto:lirian.ostrovica at senecac.on.ca]
>      Sent: Tuesday, April 15, 2003 1:45 PM
>      To: opensource at jcorporate.com
>      Subject: [Opensource] If not logged in users want to set
>      their Locale
>
>
>      Hi,
>
>      If a not logged in (and no session) user wants to get, let
>      say, the French
>      version of your i18n-alized web site, you have to send him
>      a cookie, and/or
>      provide some kind of your own URL rewriting.
>      This because the user Locales can only be saved in user
>      preferences (Expresso)
>      or in user session (Expresso & Struts).
>
>      Has someone come across this before ?
>
>      Lirian
>
>      _______________________________________________
>      Opensource mailing list
>      Opensource at jcorporate.com
>      http://mail.jcorporate.com/mailman/listinfo/opensource
>      Archives: http://mail.jcorporate.com/pipermail/opensource/
>
> _______________________________________________
> Opensource mailing list
> Opensource at jcorporate.com
> http://mail.jcorporate.com/mailman/listinfo/opensource
> Archives: http://mail.jcorporate.com/pipermail/opensource/

_______________________________________________
Opensource mailing list
Opensource at jcorporate.com
http://mail.jcorporate.com/mailman/listinfo/opensource
Archives: http://mail.jcorporate.com/pipermail/opensource/



More information about the Opensource mailing list