Re: ERMailDeliveryHTML + Localization ?!?!

2012-10-26 Thread Riccardo De Menna
Hi Kieran,

As you suggested I went a little deeper and found the problem.

I'm often faced with the need to send a quick email from my code while building 
a response page for the user. For example, in this case, the admin user of the 
website has a button to reset regular user passwords and the system 
automatically sends an email with the new password to them.
If I build the ERMailDeliveryHTML passing my current context to it, it messes 
up the context that, I assume, expects to work on the admin response page 
rather than the email. I usually build the page with something like:

ERMailDeliveryHTML mail = new ERMailDeliveryHTML( ERXWOContext.newContext() );

This would give me a fresh new context suitable for the email while leaving the 
regular one building the page response untouched.
Problem is that, by doing this, this new context does not seem to pick up the 
localizer because it probably has no track of the session.

The solution that works for me is to create the email passing a clone of the 
current context as in:

ERXWOContext regularContext = 
(ERXWOContext)ERXThreadStorage.valueForKey(ERXWOContext.CONTEXT_KEY);
ERXWOContextnewContext = (ERXWOContext)context.clone();
ERMailDeliveryHTML mail = new ERMailDeliveryHTML( newContext );

Don't know if this is the advisable course of action. Hope this helps someone,

Regards,
Riccardo

On 24/ott/2012, at 19:26, Kieran Kelleher kelleh...@gmail.com wrote:

 ERMailDeliveryHTML content is WOComponent-based, so assuming you are using 
 localized string elements, why not try debugging what's going on with getting 
 the current localizer in 
 er.extensions.localization.ERXLocalizer.currentLocalizer()  if you are 
 generating emails in a background thread you may need to stuff the 
 appropriate localizer into ERXThreadStorage or sth like that.
 
 
 On Oct 24, 2012, at 7:06 AM, Riccardo De Menna deme...@tuorlo.net wrote:
 
 Hi all,
 
 I'm delivering a standard password reset email using ERMailDeliveryHTML. It 
 works perfectly but my client has asked me to localize the website in 
 multiple languages and, I don't know why, but ERMailDeliveryHTML does not 
 seem to pickup the different .lprj folders in the components directory. 
 Setting the localizer to a different language has no effect and the email is 
 always sent in english.
 
 I'm not even sure ERMailDeliveryHTML does support localization. Anyone knows 
 more about it?
 
 Thank you,
 Riccardo De Menna
 ___
 Do not post admin requests to the list. They will be ignored.
 Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/webobjects-dev/kelleherk%40gmail.com
 
 This email sent to kelleh...@gmail.com
 


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


ERMailDeliveryHTML + Localization ?!?!

2012-10-24 Thread Riccardo De Menna
Hi all,

I'm delivering a standard password reset email using ERMailDeliveryHTML. It 
works perfectly but my client has asked me to localize the website in multiple 
languages and, I don't know why, but ERMailDeliveryHTML does not seem to pickup 
the different .lprj folders in the components directory. Setting the localizer 
to a different language has no effect and the email is always sent in english.

I'm not even sure ERMailDeliveryHTML does support localization. Anyone knows 
more about it?

Thank you,
Riccardo De Menna
 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: ERMailDeliveryHTML + Localization ?!?!

2012-10-24 Thread Kieran Kelleher
ERMailDeliveryHTML content is WOComponent-based, so assuming you are using 
localized string elements, why not try debugging what's going on with getting 
the current localizer in 
er.extensions.localization.ERXLocalizer.currentLocalizer()  if you are 
generating emails in a background thread you may need to stuff the appropriate 
localizer into ERXThreadStorage or sth like that.


On Oct 24, 2012, at 7:06 AM, Riccardo De Menna deme...@tuorlo.net wrote:

 Hi all,
 
 I'm delivering a standard password reset email using ERMailDeliveryHTML. It 
 works perfectly but my client has asked me to localize the website in 
 multiple languages and, I don't know why, but ERMailDeliveryHTML does not 
 seem to pickup the different .lprj folders in the components directory. 
 Setting the localizer to a different language has no effect and the email is 
 always sent in english.
 
 I'm not even sure ERMailDeliveryHTML does support localization. Anyone knows 
 more about it?
 
 Thank you,
 Riccardo De Menna
 ___
 Do not post admin requests to the list. They will be ignored.
 Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/webobjects-dev/kelleherk%40gmail.com
 
 This email sent to kelleh...@gmail.com


 ___
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list  (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com