You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Marieke Vandamme <ma...@tvh.be> on 2010/06/08 12:30:07 UTC

get resource translation with specific locale

Hello, 

Is it possible to use the getString or some other kind of function to get
translation not in the language of the session, but one that is different?
We need this to send email, but this email is to our internal employees, so
needs to be in language other than the one that is requesting something. 

Now I save the locale from the session into a temp-locale variable, and
change the locale from the session to the email-language. Than I can use the
getString function. Afterwards I put the temp-locale variable back into the
session. I don't find this a perfect solution, so I have you guys have some
better alternative. 

Thanks for any help ! Marieke
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/get-resource-translation-with-specific-locale-tp2247162p2247162.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: get resource translation with specific locale

Posted by Erik van Oosten <e....@grons.nl>.
Hi Marieke,

So you are using getString? In that case my suggestion won't work.
You could still add an invisible component to the form, but that's about 
as hairy as temporarily setting the session locale.

     Erik.

Op 09-06-10 14:24, Marieke Vandamme schreef:
> Hi Erik,
>
> problem is that I generate the emailtext in the onSubmit of my form. The
> data that is printed in my form, and visible to the webuser, needs to be in
> the locale from the session. So I can't override the getLocale from the
> Form. Or am I missing something?
> Thanks, Marieke
>    

-- 
Erik van Oosten
http://www.day-to-day-stuff.blogspot.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: get resource translation with specific locale

Posted by Marieke Vandamme <ma...@tvh.be>.
Hi Erik,

problem is that I generate the emailtext in the onSubmit of my form. The
data that is printed in my form, and visible to the webuser, needs to be in
the locale from the session. So I can't override the getLocale from the
Form. Or am I missing something? 
Thanks, Marieke
-- 
View this message in context: http://apache-wicket.1842946.n4.nabble.com/get-resource-translation-with-specific-locale-tp2247162p2248749.html
Sent from the Wicket - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: get resource translation with specific locale

Posted by Erik van Oosten <e....@grons.nl>.
Hi Marieke,

To force a component to be rendered in another locale (in this case your 
e-mail), you can override getLocale() from the top-most component that 
is used to render the e-mail.

Regards,
     Erik.


On Tue, Jun 8, 2010 at 3:30 AM, Marieke 
Vandamme<ma...@tvh.be> wrote:
>> Hello,
>>
>> Is it possible to use the getString or some other kind of function to get
>> translation not in the language of the session, but one that is different?
>> We need this to send email, but this email is to our internal employees, so
>> needs to be in language other than the one that is requesting something.
>>
>> Now I save the locale from the session into a temp-locale variable, and
>> change the locale from the session to the email-language. Than I can use the
>> getString function. Afterwards I put the temp-locale variable back into the
>> session. I don't find this a perfect solution, so I have you guys have some
>> better alternative.
>>
>> Thanks for any help ! Marieke
>> --
>> View this message in context: http://apache-wicket.1842946.n4.nabble.com/get-resource-translation-with-specific-locale-tp2247162p2247162.html
>>      

-- 
Erik van Oosten
http://www.day-to-day-stuff.blogspot.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: get resource translation with specific locale

Posted by Igor Vaynberg <ig...@gmail.com>.
looks like somewhere along the way we lost that ability, eg

Locale#public String getString(final String key, final Component
component, final IModel<?> model, 	final Locale locale, final String
style, final String defaultValue)

is deprecated and localizer now only pulls the locale from the
specified component. please add an rfe to readd this functionality.

-igor

On Tue, Jun 8, 2010 at 3:30 AM, Marieke Vandamme
<ma...@tvh.be> wrote:
>
> Hello,
>
> Is it possible to use the getString or some other kind of function to get
> translation not in the language of the session, but one that is different?
> We need this to send email, but this email is to our internal employees, so
> needs to be in language other than the one that is requesting something.
>
> Now I save the locale from the session into a temp-locale variable, and
> change the locale from the session to the email-language. Than I can use the
> getString function. Afterwards I put the temp-locale variable back into the
> session. I don't find this a perfect solution, so I have you guys have some
> better alternative.
>
> Thanks for any help ! Marieke
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/get-resource-translation-with-specific-locale-tp2247162p2247162.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org