You are here

function locale_user in Drupal 4

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

Implementation of hook_user().

File

modules/locale.module, line 142
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']);
    }
    $languages['name'] = array_map('check_plain', $languages['name']);
    $form['locale'] = array(
      '#type' => 'fieldset',
      '#title' => t('Interface language settings'),
      '#weight' => 1,
    );
    $form['locale']['language'] = array(
      '#type' => 'radios',
      '#title' => t('Language'),
      '#default_value' => $user->language,
      '#options' => $languages['name'],
      '#description' => t('Selecting a different locale will change the interface language of the site.'),
    );
    return $form;
  }
}