You are here

function locale_user in Drupal 5

Same name and namespace in other branches
  1. 4 modules/locale.module \locale_user()
  2. 6 modules/locale/locale.module \locale_user()

Implementation of hook_user().

File

modules/locale/locale.module, line 133
Enables administrators to manage the site interface languages.

Code

function locale_user($type, $edit, &$user, $category = NULL) {
  $languages = locale_supported_languages();
  if ($type == 'form' && $category == 'account' && count($languages['name']) > 1) {
    if ($user->language == '') {
      $user->language = key($languages['name']);
    }
    foreach (array_map('t', $languages['name']) as $key => $value) {
      $languages_name[check_plain($key)] = check_plain($value);
    }
    $form['locale'] = array(
      '#type' => 'fieldset',
      '#title' => t('Interface language settings'),
      '#weight' => 1,
    );
    $form['locale']['language'] = array(
      '#type' => 'radios',
      '#title' => t('Language'),
      '#default_value' => check_plain($user->language),
      '#options' => $languages_name,
      '#description' => t('Selecting a different locale will change the interface language of the site.'),
    );
    return $form;
  }
}