Oh, and that's not magic or anything.  It's documented (as Jesse Kunhert
pointed out to me) on this page:

http://jakarta.apache.org/tapestry/UsersGuide/localization.html#localization
.accepted-locales

Basically, you can set a list of locales that you want to accept.  When none
of the locales sent by the browser match what you have listed, it will
return the first one as the default (fr in your case).

-----Original Message-----
From: James Carman [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 17, 2006 8:52 PM
To: 'Tapestry users'
Subject: RE: Very simple localization

Nevermind the filter.  Try this in your application file...

<DEFANGED_meta key="org.apache.tapestry.accepted-locales" value="fr"/>

-----Original Message-----
From: Oscar Picasso [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 17, 2006 8:15 PM
To: Tapestry users
Subject: Re: Very simple localization

I am trying to understand how to implement a solution based on
WebRequestServicerFilter. I don't see where I could set the locale.

I though of using the service method parameter(s) but none of these object
have a setLocale method. I don't see either any of these parameters that
could provide me with an object where I could set a locale.

James Carman <[EMAIL PROTECTED]> wrote: Sure.  Here's an example
which does open-session-in-view (hibernate stuff):

http://www.carmanconsulting.com/svn/public/tapernate/trunk/src/java/com/carm
anconsulting/tapernate/filter/OpenSessionInViewFilter.java

And, here's how you configure it in your hivemodule.xml file:

http://www.carmanconsulting.com/svn/public/tapernate/trunk/src/java/META-INF
/hivemodule.xml

Notice you have both a service point and a contribution at the top.

> Not sure about what you mean by WebRequestFilter.
>
> How to use it? Where to find? Is it something I need to implement?
> Extends?
>
> Maybe some code would help me to understand what you are talking about.
>
> James Carman  wrote: Can you try using a
> WebRequestFilter?  You can inject the cycle into your
> filter and set the locale there.
>
>> My case is somewhat different.
>>
>> 1- I use Tapestry 4.
>> 2- All the pages need to be served in french, not only specific pages
>> like
>> login.
>>
>> [EMAIL PROTECTED] wrote: Try something like this.....this is
>> how
>> we dynamically change languages at
>> login....Tapestry 3.0.3...
>>
>> Locale selectedLocale = new Locale("fr");
>> cycle.getEngine().setLocale(selectedLocale);
>> // not sure what this does...
>> cycle.cleanup();
>> cycle.activate("Login"); // reload page
>>
>>   - Mike
>>
>>
>>
>>
>>
>> Oscar Picasso
>> 04/17/2006 02:50 PM
>> Please respond to
>> "Tapestry users"
>>
>>
>> To
>> Tapestry users
>> cc
>>
>> Subject
>> Very simple localization
>>
>>
>>
>>
>>
>>
>> That one should be very simple.
>>
>> I want to serve all my application pages in french, regardless of the
>> user
>> browser setting.
>>
>> I've try to overide BaseEgine with a FrenchEngine:
>>
>> @Override
>> public void setLocale(Locale locale) {
>>     System.out.println("setting locale");
>>     super.setLocale(new Locale("fr", "FR"));
>> }
>>
>> I can see that the setLocale I used when I hit the pages but the pages
>> are
>> still served according the user browser setting.
>>
>> What should I do?
>>
>> __________________________________________________
>> Do You Yahoo!?
>> Tired of spam?  Yahoo! Mail has the best spam protection around
>> http://mail.yahoo.com
>>
>>
>>
>> ---------------------------------
>> Yahoo! Messenger with Voice. PC-to-Phone calls for ridiculously low
>> rates.
>
>
> James Carman, President
> Carman Consulting, Inc.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
> ---------------------------------
> Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+
> countries) for 2¢/min or less.


James Carman, President
Carman Consulting, Inc.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



                
---------------------------------
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+
countries) for 2¢/min or less.



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

Reply via email to