When an administrator creates a new user account on behalf of that new user, the mail that gets sent to the user in the language the administrator used to create the account. Would there be a way to switch this to the langauge that was selected as the preferred langauge for the new user?

Example:
- i18n_variable enabled
- mail variables checked as being multiluingual variables, including the variable user_mail_register_admin_created_body (and ..._subject) 'Welcome, new user created by administrator' and translated to all languages (on the admin/config/people/accounts page)

- A Dutch administrator creates an account for a French user, on page nl/admin/people/create.
- French is checked as the preferred language for the new user.
- The welcome mail gets sent in Dutch.

Possible solution: the administrator should create French users on fr/admin/people/create, instead of nl/admin/people/create, but that may become very difficult when he has to add Hebrew speaking users.

Looking at the code it looks like it is possible, with some custom code, to switch the variable system to another language. (calling function i18n_variable_initialize()). But what hooks to use to do so just before sending the email and restore the language directly after sending the e-mail?

Any hints would be appreciated.

Comments

Jose Reyero’s picture

Possibly youd need to overrid the whole form submit, and handle the mail sending with variables in the proper language. You can use i18n_variable_get() to retrieve a single variable in any language.

webflo’s picture

This features is implemented in a sandbox. See i18n_user. Maybe we merge it later into i18n.

Jose Reyero’s picture