function locale_form_alter

7.x locale.module locale_form_alter(&$form, &$form_state, $form_id)
6.x locale.module locale_form_alter(&$form, $form_state, $form_id)

Implements hook_form_alter().

Adds language fields to user forms.

File

drupal-7.x/modules/locale/locale.module, line 352
Add language handling functionality and enables the translation of the user interface to languages other than English.

Code

function locale_form_alter(&$form, &$form_state, $form_id) {
  // Only alter user forms if there is more than one language.
  if (drupal_multilingual()) {
    // Display language selector when either creating a user on the admin
    // interface or editing a user account.
    if ($form_id == 'user_register_form' || ($form_id == 'user_profile_form' && $form['#user_category'] == 'account')) {
      locale_language_selector_form($form, $form_state, $form['#user']);
    }
  }
}