2
// $Id: i18n.pages.inc,v 1.1.2.1 2009/01/21 13:08:35 jareyero Exp $
6
* User page callbacks for the translation module.
10
* Overview page for a node's translations.
12
* Replacement for Drupal core translation module's pages
17
function i18n_translation_node_overview($node) {
19
// Already part of a set, grab that set.
21
$translations = translation_node_get_translations($node->tnid);
24
// We have no translation source nid, this could be a new set, emulate that.
26
$translations = array($node->language => $node);
29
$header = array(t('Language'), t('Title'), t('Status'), t('Operations'));
31
foreach (language_list() as $language) {
33
$language_name = $language->name;
34
// We may need to switch interface language for translations
35
$params = variable_get('i18n_translation_switch', 0) ? array('language' => $language) : array();
36
if (isset($translations[$language->language])) {
37
// Existing translation in the translation set: display status.
38
// We load the full node to check whether the user can edit it.
39
$translation_node = node_load($translations[$language->language]->nid);
40
$title = l($translation_node->title, 'node/'. $translation_node->nid, $params);
41
if (node_access('update', $translation_node)) {
42
$options[] = l(t('edit'), "node/$translation_node->nid/edit", $params);
44
$status = $translation_node->status ? t('Published') : t('Not published');
45
$status .= $translation_node->translate ? ' - <span class="marker">'. t('outdated') .'</span>' : '';
46
if ($translation_node->nid == $tnid) {
47
$language_name = t('<strong>@language_name</strong> (source)', array('@language_name' => $language_name));
51
// No such translation in the set yet: help user to create it.
53
if (node_access('create', $node)) {
54
$options[] = l(t('add translation'), 'node/add/'. str_replace('_', '-', $node->type), array('query' => "translation=$node->nid&language=$language->language") + $params);
56
$status = t('Not translated');
58
$rows[] = array($language_name, $title, $status, implode(" | ", $options));
61
drupal_set_title(t('Translations of %title', array('%title' => $node->title)));
62
return theme('table', $header, $rows);