You are here

function locale_menu in Drupal 5

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

Implementation of hook_menu().

File

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

Code

function locale_menu($may_cache) {
  $items = array();
  $access = user_access('administer locales');
  if ($may_cache) {

    // Main admin menu item
    $items[] = array(
      'path' => 'admin/settings/locale',
      'title' => t('Localization'),
      'description' => t('Configure site localization and user interface translation.'),
      'callback' => 'locale_admin_manage',
      'access' => $access,
    );

    // Top level tabs
    $items[] = array(
      'path' => 'admin/settings/locale/language',
      'title' => t('Manage languages'),
      'access' => $access,
      'weight' => -10,
      'type' => MENU_DEFAULT_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/settings/locale/string/search',
      'title' => t('Manage strings'),
      'callback' => 'locale_string_search',
      'access' => $access,
      'weight' => 10,
      'type' => MENU_LOCAL_TASK,
    );

    // Manage languages subtabs
    $items[] = array(
      'path' => 'admin/settings/locale/language/overview',
      'title' => t('List'),
      'callback' => 'locale_admin_manage',
      'access' => $access,
      'weight' => 0,
      'type' => MENU_DEFAULT_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/settings/locale/language/add',
      'title' => t('Add language'),
      'callback' => 'locale_admin_manage_add',
      'access' => $access,
      'weight' => 5,
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/settings/locale/language/import',
      'title' => t('Import'),
      'callback' => 'locale_admin_import',
      'access' => $access,
      'weight' => 10,
      'type' => MENU_LOCAL_TASK,
    );
    $items[] = array(
      'path' => 'admin/settings/locale/language/export',
      'title' => t('Export'),
      'callback' => 'locale_admin_export',
      'access' => $access,
      'weight' => 20,
      'type' => MENU_LOCAL_TASK,
    );

    // Language related callbacks
    $items[] = array(
      'path' => 'admin/settings/locale/language/delete',
      'title' => t('Confirm'),
      'callback' => 'drupal_get_form',
      'callback arguments' => array(
        'locale_admin_manage_delete_form',
      ),
      'access' => $access,
      'type' => MENU_CALLBACK,
    );
  }
  else {
    if (is_numeric(arg(5))) {

      // String related callbacks
      $items[] = array(
        'path' => 'admin/settings/locale/string/edit/' . arg(5),
        'title' => t('Edit string'),
        'callback' => 'drupal_get_form',
        'callback arguments' => array(
          'locale_admin_string_edit',
          arg(5),
        ),
        'access' => $access,
        'type' => MENU_CALLBACK,
      );
      $items[] = array(
        'path' => 'admin/settings/locale/string/delete/' . arg(5),
        'title' => t('Delete string'),
        'callback' => 'locale_admin_string_delete_page',
        'callback arguments' => array(
          arg(5),
        ),
        'access' => $access,
        'type' => MENU_CALLBACK,
      );
    }
  }
  return $items;
}