Hello,

I added the following code (from another post within this forum) to my site that allows the user to choose his preferred language during the registration process:

function mymodule_form_alter($form, &$form_state, $form_id) {
    if ($form_id == 'user_register') {
        global $language;
        $languages = language_list('enabled');
        $languages = $languages[1];

        // If the user is being created, we set the user language to the page language.
        //$user_preferred_language = $user ? user_preferred_language($user) : $language;
        $user_preferred_language = $language;

        $names = array();
        foreach ($languages as $langcode => $item) {
          $name = t($item->name);
          $names[$langcode] = $name . ($item->native != $name ? ' ('. $item->native .')' : '');
        }
        $form['locale'] = array(
          '#type' => 'fieldset',
          '#title' => t('Language settings'),
          '#weight' => 1,
        );

        $form['locale']['language'] = array(
          '#type' => (count($names) <= 5 ? 'radios' : 'select'),
          '#title' => t('Language'),
          '#default_value' => $user_preferred_language->language,
          '#options' => $names,
          '#description' => t("This account's default language for e-mails."),
        );
    }
}

The user can select his preferred language:

  • English
  • German

If he select German, the confirmation mail is still in English. I translated the strings from the "User settings" page that are within the "Welcome, no approval required" field to German ("Translate interface").

Do you have any idea why the system still sends the confirmation mail in English and not in German?

Many thanks,
Faustas

Comments

Faustas’s picture

Is there anybody who could solve the problem and could send the registration mails in different languages depending on the user language?

Anonymous’s picture

Have you found a solution to this?

ducdebreme’s picture

subscribing

Le Duc de Brême - http://www.early-dance.de

chinita7’s picture

I have the same problem. I installed registration language module. But my "Welcome, no approval required" mail is always in the default language(Japanese)