You are here

function locale_user in Localization client 5

Implementation of hook_user().

File

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']);
    }
    $languages['name'] = array_map('check_plain', array_map('t', $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;
  }
}