You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Michal Hlavac <hl...@medium13.sk> on 2005/03/14 12:10:07 UTC

set locale on first request

hello,

I need to change locale on the first request of every visitor...

How can I do that??? I am lost in space... ;)

thanks, miso


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: set locale on first request

Posted by Hugo Palma <hp...@digitalis.pt>.
It works fine for me also.
Can you post the code where u change the locale please ?

Thanks

Hugo

Ron Piterman wrote:

> I tested it shortly : on my Home I yeald the engine's locale - and it 
> worked.
>
> I had trouble replacing the engine class, but since you get the stdout 
> output it should not be a problem...
>
> Try it with something obscure but sure like Locale.CHINESE instead of 
> your constructor.
>
> How do you know it doesn't work?
>
> Cheers,
> Ron
>
>
>
>
>  Michal Hlavac:
>
>> Hugo Palma wrote:
>>
>>> Override the engine method setLocale like this:
>>>
>>> public final void setLocale(Locale locale)
>>>   {
>>>      if (getLocale() == null)
>>>         super.setLocale(new Locale(defaultLanguage, defaultCountry));
>>>      else
>>>         super.setLocale(locale);
>>>   }
>>>
>>
>> Hello Hugo,
>>
>> sorry for disturbing... but I need solve this problem... ;(
>> As I wrote application runs super.setLocale(new 
>> Locale(defaultLanguage, defaultCountry)), but no language change... 
>> And no cookie saved.
>>
>> If you know, where can be problem, please let me know...
>>
>> thanks, miso
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: set locale on first request

Posted by Ron Piterman <mp...@vollbio.de>.
I tested it shortly : on my Home I yeald the engine's locale - and it 
worked.

I had trouble replacing the engine class, but since you get the stdout 
output it should not be a problem...

Try it with something obscure but sure like Locale.CHINESE instead of 
your constructor.

How do you know it doesn't work?

Cheers,
Ron




  Michal Hlavac:
> Hugo Palma wrote:
> 
>> Override the engine method setLocale like this:
>>
>> public final void setLocale(Locale locale)
>>   {
>>      if (getLocale() == null)
>>         super.setLocale(new Locale(defaultLanguage, defaultCountry));
>>      else
>>         super.setLocale(locale);
>>   }
>>
> 
> Hello Hugo,
> 
> sorry for disturbing... but I need solve this problem... ;(
> As I wrote application runs super.setLocale(new Locale(defaultLanguage, 
> defaultCountry)), but no language change... And no cookie saved.
> 
> If you know, where can be problem, please let me know...
> 
> thanks, miso
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: set locale on first request

Posted by Michal Hlavac <hl...@medium13.sk>.
Hugo Palma wrote:
> Override the engine method setLocale like this:
> 
> public final void setLocale(Locale locale)
>   {
>      if (getLocale() == null)
>         super.setLocale(new Locale(defaultLanguage, defaultCountry));
>      else
>         super.setLocale(locale);
>   }
> 

Hello Hugo,

sorry for disturbing... but I need solve this problem... ;(
As I wrote application runs super.setLocale(new Locale(defaultLanguage, 
defaultCountry)), but no language change... And no cookie saved.

If you know, where can be problem, please let me know...

thanks, miso

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: set locale on first request

Posted by ron <ro...@gmx.net>.
Will try it later and let you know.
My posting was wrong in saying this is problematic. It should work as 
far as I can see...
Cheers,
Ron


ציטוט Michal Hlavac:

> ron wrote:
>
>> Forget this, sorry... :(
>
>
> so it means, that it works for you???
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: set locale on first request

Posted by Michal Hlavac <hl...@medium13.sk>.
ron wrote:
> Forget this, sorry... :(

so it means, that it works for you???

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: set locale on first request

Posted by ron <ro...@gmx.net>.
Forget this, sorry... :(

ציטוט ron:

> Hi,
> Problem is, this way you will not be able to change to another locale. 
> The application will have *only* one locale. :(
>
>
> ציטוט Hugo Palma:
>
>> Override the engine method setLocale like this:
>>
>> public final void setLocale(Locale locale)
>>   {
>>      if (getLocale() == null)
>>         super.setLocale(new Locale(defaultLanguage, defaultCountry));
>>      else
>>         super.setLocale(locale);
>>   }
>>
>>
>> ron wrote:
>>
>>> Dito...
>>> thought of doing it by overriding engine, but am not sure where and 
>>> what...
>>>
>>> ציטוט Michal Hlavac:
>>>
>>>> hello,
>>>>
>>>> I need to change locale on the first request of every visitor...
>>>>
>>>> How can I do that??? I am lost in space... ;)
>>>>
>>>> thanks, miso
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: set locale on first request

Posted by ron <ro...@gmx.net>.
Hi,
Problem is, this way you will not be able to change to another locale. 
The application will have *only* one locale. :(


ציטוט Hugo Palma:

> Override the engine method setLocale like this:
>
> public final void setLocale(Locale locale)
>   {
>      if (getLocale() == null)
>         super.setLocale(new Locale(defaultLanguage, defaultCountry));
>      else
>         super.setLocale(locale);
>   }
>
>
> ron wrote:
>
>> Dito...
>> thought of doing it by overriding engine, but am not sure where and 
>> what...
>>
>> ציטוט Michal Hlavac:
>>
>>> hello,
>>>
>>> I need to change locale on the first request of every visitor...
>>>
>>> How can I do that??? I am lost in space... ;)
>>>
>>> thanks, miso
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: set locale on first request

Posted by ron <ro...@gmx.net>.
I Added TrickAndTip in the Wiki, quoting you...
Thanx

ציטוט Hugo Palma:

> Override the engine method setLocale like this:
>
> public final void setLocale(Locale locale)
>   {
>      if (getLocale() == null)
>         super.setLocale(new Locale(defaultLanguage, defaultCountry));
>      else
>         super.setLocale(locale);
>   }
>
>
> ron wrote:
>
>> Dito...
>> thought of doing it by overriding engine, but am not sure where and 
>> what...
>>
>> ציטוט Michal Hlavac:
>>
>>> hello,
>>>
>>> I need to change locale on the first request of every visitor...
>>>
>>> How can I do that??? I am lost in space... ;)
>>>
>>> thanks, miso
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: set locale on first request

Posted by Michal Hlavac <hl...@medium13.sk>.
Hugo Palma wrote:
> Override the engine method setLocale like this:
> 
> public final void setLocale(Locale locale)
>   {
>      if (getLocale() == null)
>         super.setLocale(new Locale(defaultLanguage, defaultCountry));
>      else
>         super.setLocale(locale);
>   }

thanks,

I tried:
	public final void setLocale(Locale locale) {
		if (getLocale() == null) {
			super.setLocale(new Locale(DiploConstants.DEFAULT_LANGUAGE));
			System.out.println("SETTINGS DEFAULT");
		}
		else {
			super.setLocale(locale);
			System.out.println("ALREADY SETUP");
		}
	}

stdout writes 'SETTINGS DEFAULT'... it looks ok, but no cookie and 
language changes...
where can be problem??

thanks, miso

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: set locale on first request

Posted by Hugo Palma <hp...@digitalis.pt>.
Override the engine method setLocale like this:

public final void setLocale(Locale locale)
   {
      if (getLocale() == null)
         super.setLocale(new Locale(defaultLanguage, defaultCountry));
      else
         super.setLocale(locale);
   }


ron wrote:

> Dito...
> thought of doing it by overriding engine, but am not sure where and 
> what...
>
> ציטוט Michal Hlavac:
>
>> hello,
>>
>> I need to change locale on the first request of every visitor...
>>
>> How can I do that??? I am lost in space... ;)
>>
>> thanks, miso
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: set locale on first request

Posted by ron <ro...@gmx.net>.
Dito...
thought of doing it by overriding engine, but am not sure where and what...

ציטוט Michal Hlavac:

> hello,
>
> I need to change locale on the first request of every visitor...
>
> How can I do that??? I am lost in space... ;)
>
> thanks, miso
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org