function translation_menu in Internationalization 5.3
Same name and namespace in other branches
- 5 translation/translation.module \translation_menu()
- 5.2 translation/translation.module \translation_menu()
Implementation of hook_menu().
File
- translation/
translation.module, line 50
Code
function translation_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'translation/autocomplete',
'title' => t('translation node autocomplete'),
'callback' => 'translation_node_autocomplete',
'access' => user_access('translate nodes'),
'type' => MENU_CALLBACK,
);
$items[] = array(
'path' => 'admin/settings/i18n/translation',
'title' => t('Translation'),
'callback' => 'drupal_get_form',
'callback arguments' => array(
'translation_admin_settings',
),
'access' => user_access('administer site configuration'),
'type' => MENU_LOCAL_TASK,
);
$items[] = array(
'path' => 'admin/content/translation',
'title' => t('Translations'),
'description' => t("Manage content translations."),
'callback' => 'translation_admin_content',
'position' => 'left',
'access' => user_access('translate nodes'),
);
$items[] = array(
'path' => 'admin/content/translation/overview',
'title' => t('List'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
}
else {
if (arg(0) == 'node' && is_numeric(arg(1)) && ($node = node_load(arg(1))) && variable_get('i18n_node_' . translation_get_node_type(arg(1)), 0)) {
$access = translation_access($node) && node_access('view', $node);
$type = MENU_LOCAL_TASK;
$items[] = array(
'path' => 'node/' . arg(1) . '/translation',
'title' => t('Translation'),
'callback' => 'translation_node_page',
'access' => $access,
'type' => $type,
'weight' => 3,
);
}
if (arg(0) == 'admin' && arg(1) == 'content' && arg(2) == 'taxonomy' && is_numeric(arg(3))) {
$items[] = array(
'path' => 'admin/content/taxonomy/' . arg(3) . '/translation',
'title' => t('Translation'),
'callback' => 'translation_taxonomy_admin',
'access' => user_access('administer taxonomy'),
'type' => MENU_LOCAL_TASK,
);
}
// Special redirections and rewrite conditions
if (arg(0) == 'node' && arg(1) == 'add' && isset($_GET['translation']) && ($source_nid = $_GET['translation']) && isset($_GET['language']) && ($lang = $_GET['language']) && array_key_exists($lang, i18n_supported_languages())) {
// Special redirection for product types. Check for product module because there may be 'product' node types created by cck
if (arg(2) == 'product' && module_exists('product') && !arg(3) && is_numeric($source_nid) && ($ptype = db_result(db_query("SELECT ptype FROM {ec_product} WHERE nid = %d", $source_nid)))) {
drupal_goto(url("node/add/product/{$ptype}", "translation={$source_nid}&language={$lang}", NULL, TRUE));
}
// Change rewrite conditions when translating node
i18n_selection_mode('translation', db_escape_string($lang));
}
}
return $items;
}