[development] translated text in module-generated emails?

Gabor Hojtsy gabor at hojtsy.hu
Wed Mar 29 20:26:40 UTC 2006


Hi Derek!

I cannot look into the user module code right now, but what it used to
do was to wrap the email *template* into a t() call. That template is
customizable by the admin. Before a customization is made, the
translation was always done on the fly. Once a customization is done,
that fixed content/language text will go out in all emails, no matter what.

The unexpected language comment you cited below refers to the fact, that
the t() call uses the current locale (ie. the one selected by the user
if the locale is selectable). So the email is sent out in that language,
if a translation is available.

Gabor

Derek Wright wrote:
> what's the right thing to do regarding the use of t() inside modules
> that are generating emails?  specifically, i'm talking about wrapping
> text that's going into an email (either subject or body) inside t().
> i'm helping to maintain the user_status.module, and noticed this
> comment:
> 
> // Probably don't want user emails to use t() since that might result
> // in some unexpected languages being sent to users.
> 
> is that true?  is the party-line that all email text should be in
> english, no matter what?  that seems a little strange.  it appears
> that user.module wraps all the default text in t().  i don't
> understand the harm in wrapping in t(), but i'm also mostly ignorant
> of drupal's translation support and efforts.  can someone either
> explain why this comment is true, or tell me it's all lies? ;)
> 
> thanks!
> -derek
> 
> 



More information about the development mailing list