### Eclipse Workspace Patch 1.0 #P [drupal] drupal_7.sviluppo Index: modules/comment/comment.test =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.test,v retrieving revision 1.47 diff -u -r1.47 comment.test --- modules/comment/comment.test 8 Oct 2009 08:16:54 -0000 1.47 +++ modules/comment/comment.test 14 Oct 2009 17:35:13 -0000 @@ -11,7 +11,7 @@ // Create users and test node. $this->admin_user = $this->drupalCreateUser(array('administer content types', 'administer comments', 'administer blocks')); $this->web_user = $this->drupalCreateUser(array('access comments', 'post comments', 'create article content')); - $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->web_user->uid)); + $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'uid' => $this->web_user->uid, 'language' => '')); } /** @@ -291,21 +291,21 @@ $this->setCommentsPerPage(50); // Attempt to post to node with comments disabled. - $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => COMMENT_NODE_HIDDEN)); + $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => COMMENT_NODE_HIDDEN, 'language' => '')); $this->assertTrue($this->node, t('Article node created.')); $this->drupalGet('comment/reply/' . $this->node->nid); $this->assertText('This discussion is closed', t('Posting to node with comments disabled')); $this->assertNoField('edit-comment', t('Comment body field found.')); // Attempt to post to node with read-only comments. - $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => COMMENT_NODE_CLOSED)); + $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => COMMENT_NODE_CLOSED, 'language' => '')); $this->assertTrue($this->node, t('Article node created.')); $this->drupalGet('comment/reply/' . $this->node->nid); $this->assertText('This discussion is closed', t('Posting to node with comments read-only')); $this->assertNoField('edit-comment', t('Comment body field found.')); // Attempt to post to node with comments enabled (check field names etc). - $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => COMMENT_NODE_OPEN)); + $this->node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'comment' => COMMENT_NODE_OPEN, 'language' => '')); $this->assertTrue($this->node, t('Article node created.')); $this->drupalGet('comment/reply/' . $this->node->nid); $this->assertNoText('This discussion is closed', t('Posting to node with comments enabled')); @@ -554,7 +554,7 @@ $this->setCommentPreview(FALSE); // Create a node and three comments. - $node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1)); + $node = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1, 'language' => '')); $comments = array(); $comments[] = $this->postComment($node, $this->randomName(), $this->randomName(), FALSE, TRUE); $comments[] = $this->postComment($node, $this->randomName(), $this->randomName(), FALSE, TRUE); Index: modules/comment/comment.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.pages.inc,v retrieving revision 1.26 diff -u -r1.26 comment.pages.inc --- modules/comment/comment.pages.inc 11 Oct 2009 03:07:17 -0000 1.26 +++ modules/comment/comment.pages.inc 14 Oct 2009 17:35:13 -0000 @@ -29,7 +29,7 @@ */ function comment_reply($node, $pid = NULL) { // Set the breadcrumb trail. - drupal_set_breadcrumb(array(l(t('Home'), NULL), l($node->title[FIELD_LANGUAGE_NONE][0]['value'], 'node/' . $node->nid))); + drupal_set_breadcrumb(array(l(t('Home'), NULL), l(node_get_translated_title($node), 'node/' . $node->nid))); $op = isset($_POST['op']) ? $_POST['op'] : ''; $build = array(); Index: modules/comment/comment.tokens.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.tokens.inc,v retrieving revision 1.5 diff -u -r1.5 comment.tokens.inc --- modules/comment/comment.tokens.inc 11 Oct 2009 03:07:18 -0000 1.5 +++ modules/comment/comment.tokens.inc 14 Oct 2009 17:35:13 -0000 @@ -209,7 +209,8 @@ case 'node': $node = node_load($comment->nid); - $title = $node->title[FIELD_LANGUAGE_NONE][0]['value']; + $node = node_build($node); + $title = node_get_translated_title($node); $replacements[$original] = $sanitize ? filter_xss($title) : $title; break; } Index: modules/node/node.test =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.test,v retrieving revision 1.47 diff -u -r1.47 node.test --- modules/node/node.test 11 Oct 2009 03:07:18 -0000 1.47 +++ modules/node/node.test 14 Oct 2009 17:35:16 -0000 @@ -967,9 +967,9 @@ * Create 3 nodes and test if they are listed on the node admistration page. */ function testNodeAdmin() { - $node1 = $this->drupalCreateNode(array('type' => 'article', 'status' => 1)); - $node2 = $this->drupalCreateNode(array('type' => 'article', 'status' => 0)); - $node3 = $this->drupalCreateNode(array('type' => 'page')); + $node1 = $this->drupalCreateNode(array('type' => 'article', 'status' => 1, 'language' => '')); + $node2 = $this->drupalCreateNode(array('type' => 'article', 'status' => 0, 'language' => '')); + $node3 = $this->drupalCreateNode(array('type' => 'page', 'language' => '')); $this->drupalGet('admin/content'); $this->assertText($node1->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node appears on the node administration listing.')); Index: modules/node/node.tokens.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.tokens.inc,v retrieving revision 1.4 diff -u -r1.4 node.tokens.inc --- modules/node/node.tokens.inc 11 Oct 2009 03:07:18 -0000 1.4 +++ modules/node/node.tokens.inc 14 Oct 2009 17:35:16 -0000 @@ -134,7 +134,7 @@ break; case 'title': - $replacements[$original] = $sanitize ? check_plain($node->title[FIELD_LANGUAGE_NONE][0]['value']) : $node->title[FIELD_LANGUAGE_NONE][0]['value']; + $replacements[$original] = $sanitize ? check_plain(node_get_original_title($node)) : node_get_original_title($node); break; case 'body': Index: modules/node/node.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v retrieving revision 1.87 diff -u -r1.87 node.pages.inc --- modules/node/node.pages.inc 11 Oct 2009 03:07:18 -0000 1.87 +++ modules/node/node.pages.inc 14 Oct 2009 17:35:16 -0000 @@ -12,7 +12,7 @@ */ function node_page_edit($node) { $type_name = node_type_get_name($node); - drupal_set_title(t('Edit @type @title', array('@type' => $type_name, '@title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), PASS_THROUGH); + drupal_set_title(t('Edit @type @title', array('@type' => $type_name, '@title' => node_get_original_title($node))), PASS_THROUGH); return drupal_get_form($node->type . '_node_form', $node); } @@ -411,8 +411,8 @@ $insert = empty($node->nid); node_save($node); $node_link = l(t('view'), 'node/' . $node->nid); - $watchdog_args = array('@type' => $node->type, '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']); - $t_args = array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']); + $watchdog_args = array('@type' => $node->type, '%title' => node_get_original_title($node)); + $t_args = array('@type' => node_type_get_name($node), '%title' => node_get_original_title($node)); if ($insert) { watchdog('content', '@type: added %title.', $watchdog_args, WATCHDOG_NOTICE, $node_link); @@ -461,7 +461,7 @@ ); return confirm_form($form, - t('Are you sure you want to delete %title?', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), + t('Are you sure you want to delete %title?', array('%title' => node_get_original_title($node))), isset($_GET['destination']) ? $_GET['destination'] : 'node/' . $node->nid, t('This action cannot be undone.'), t('Delete'), @@ -476,8 +476,8 @@ if ($form_state['values']['confirm']) { $node = node_load($form_state['values']['nid']); node_delete($form_state['values']['nid']); - watchdog('content', '@type: deleted %title.', array('@type' => $node->type, '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])); - drupal_set_message(t('@type %title has been deleted.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']))); + watchdog('content', '@type: deleted %title.', array('@type' => $node->type, '%title' => node_get_original_title($node))); + drupal_set_message(t('@type %title has been deleted.', array('@type' => node_type_get_name($node), '%title' => node_get_original_title($node)))); } $form_state['redirect'] = ''; @@ -487,7 +487,7 @@ * Generate an overview table of older revisions of a node. */ function node_revision_overview($node) { - drupal_set_title(t('Revisions for %title', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), PASS_THROUGH); + drupal_set_title(t('Revisions for %title', array('%title' => node_get_original_title($node))), PASS_THROUGH); $header = array(t('Revision'), array('data' => t('Operations'), 'colspan' => 2)); @@ -549,8 +549,8 @@ node_save($node_revision); - watchdog('content', '@type: reverted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->title[FIELD_LANGUAGE_NONE][0]['value'], '%revision' => $node_revision->vid)); - drupal_set_message(t('@type %title has been reverted back to the revision from %revision-date.', array('@type' => node_type_get_name($node_revision), '%title' => $node_revision->title[FIELD_LANGUAGE_NONE][0]['value'], '%revision-date' => format_date($node_revision->revision_timestamp)))); + watchdog('content', '@type: reverted %title revision %revision.', array('@type' => $node_revision->type, '%title' => node_get_original_title($node_revision), '%revision' => $node_revision->vid)); + drupal_set_message(t('@type %title has been reverted back to the revision from %revision-date.', array('@type' => node_type_get_name($node_revision), '%title' => node_get_original_title($node_revision), '%revision-date' => format_date($node_revision->revision_timestamp)))); $form_state['redirect'] = 'node/' . $node_revision->nid . '/revisions'; } @@ -563,8 +563,8 @@ $node_revision = $form['#node_revision']; node_revision_delete($node_revision->vid); - watchdog('content', '@type: deleted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->title[FIELD_LANGUAGE_NONE][0]['value'], '%revision' => $node_revision->vid)); - drupal_set_message(t('Revision from %revision-date of @type %title has been deleted.', array('%revision-date' => format_date($node_revision->revision_timestamp), '@type' => node_type_get_name($node_revision), '%title' => $node_revision->title[FIELD_LANGUAGE_NONE][0]['value']))); + watchdog('content', '@type: deleted %title revision %revision.', array('@type' => $node_revision->type, '%title' => node_get_original_title($node_revision), '%revision' => $node_revision->vid)); + drupal_set_message(t('Revision from %revision-date of @type %title has been deleted.', array('%revision-date' => format_date($node_revision->revision_timestamp), '@type' => node_type_get_name($node_revision), '%title' => node_get_original_title($node_revision)))); $form_state['redirect'] = 'node/' . $node_revision->nid; if (db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid', array(':nid' => $node_revision->nid))->fetchField() > 1) { $form_state['redirect'] .= '/revisions'; Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.1145 diff -u -r1.1145 node.module --- modules/node/node.module 11 Oct 2009 03:07:18 -0000 1.1145 +++ modules/node/node.module 14 Oct 2009 17:35:15 -0000 @@ -578,6 +578,7 @@ $field = array( 'field_name' => 'title', 'type' => 'text', + 'translatable' => TRUE, ); $field = field_create_field($field); } @@ -935,8 +936,7 @@ // column. After this we restore the field data structure to the previous node // title field. $title_field = $node->title; - $langcode = FIELD_LANGUAGE_NONE; - $node->title = $title_field[$langcode][0]['value']; + $node->title = node_get_original_title($node); // Generate the node table query and the node_revisions table query. if ($node->is_new) { @@ -1157,7 +1157,7 @@ $links['node_readmore'] = array( 'title' => t('Read more'), 'href' => 'node/' . $node->nid, - 'attributes' => array('rel' => 'tag', 'title' => strip_tags($node->title[FIELD_LANGUAGE_NONE][0]['value'])) + 'attributes' => array('rel' => 'tag', 'title' => strip_tags(node_get_translated_title($node))) ); } $node->content['links']['node'] = array( @@ -1231,7 +1231,7 @@ */ function node_show($node, $message = FALSE) { if ($message) { - drupal_set_title(t('Revision of %title from %date', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'], '%date' => format_date($node->revision_timestamp))), PASS_THROUGH); + drupal_set_title(t('Revision of %title from %date', array('%title' => node_get_original_title($node), '%date' => format_date($node->revision_timestamp))), PASS_THROUGH); } // Update the history table, stating that this user viewed this node. @@ -1265,7 +1265,7 @@ $variables['date'] = format_date($node->created); $variables['name'] = theme('username', array('account' => $node)); $variables['node_url'] = url('node/' . $node->nid); - $variables['node_title'] = check_plain($node->title[FIELD_LANGUAGE_NONE][0]['value']); + $variables['node_title'] = check_plain(node_get_translated_title($node)); $variables['page'] = (bool)menu_get_object(); if (!empty($node->in_preview)) { @@ -1515,7 +1515,7 @@ $results[] = array( 'link' => url('node/' . $item->sid, array('absolute' => TRUE)), 'type' => check_plain(node_type_get_name($node)), - 'title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'], + 'title' => node_get_translated_title($node), 'user' => theme('username', array('account' => $node)), 'date' => $node->changed, 'node' => $node, @@ -1997,7 +1997,7 @@ $item_text .= drupal_render($node->content) . $links; } - $items .= format_rss_item($node->title[FIELD_LANGUAGE_NONE][0]['value'], $node->link, $item_text, $node->rss_elements); + $items .= format_rss_item(node_get_translated_title($node), $node->link, $item_text, $node->rss_elements); } $channel_defaults = array( @@ -2135,7 +2135,7 @@ node_build_content($node, 'search_index'); $node->rendered = drupal_render($node->content); - $text = '

' . check_plain($node->title[FIELD_LANGUAGE_NONE][0]['value']) . '

' . $node->rendered; + $text = '

' . check_plain(node_get_translated_title($node)) . '

' . $node->rendered; // Fetch extra data normally not visible $extra = module_invoke_all('node_update_index', $node); @@ -2979,7 +2979,7 @@ */ function node_publish_action($node, $context = array()) { $node->status = NODE_PUBLISHED; - watchdog('action', 'Set @type %title to published.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])); + watchdog('action', 'Set @type %title to published.', array('@type' => node_type_get_name($node), '%title' => node_get_original_title($node))); } /** @@ -2988,7 +2988,7 @@ */ function node_unpublish_action($node, $context = array()) { $node->status = NODE_NOT_PUBLISHED; - watchdog('action', 'Set @type %title to unpublished.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])); + watchdog('action', 'Set @type %title to unpublished.', array('@type' => node_type_get_name($node), '%title' => node_get_original_title($node))); } /** @@ -2997,7 +2997,7 @@ */ function node_make_sticky_action($node, $context = array()) { $node->sticky = NODE_STICKY; - watchdog('action', 'Set @type %title to sticky.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])); + watchdog('action', 'Set @type %title to sticky.', array('@type' => node_type_get_name($node), '%title' => node_get_original_title($node))); } /** @@ -3006,7 +3006,7 @@ */ function node_make_unsticky_action($node, $context = array()) { $node->sticky = NODE_NOT_STICKY; - watchdog('action', 'Set @type %title to unsticky.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])); + watchdog('action', 'Set @type %title to unsticky.', array('@type' => node_type_get_name($node), '%title' => node_get_original_title($node))); } /** @@ -3015,7 +3015,7 @@ */ function node_promote_action($node, $context = array()) { $node->promote = NODE_PROMOTED; - watchdog('action', 'Promoted @type %title to front page.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])); + watchdog('action', 'Promoted @type %title to front page.', array('@type' => node_type_get_name($node), '%title' => node_get_original_title($node))); } /** @@ -3024,7 +3024,7 @@ */ function node_unpromote_action($node, $context = array()) { $node->promote = NODE_NOT_PROMOTED; - watchdog('action', 'Removed @type %title from front page.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])); + watchdog('action', 'Removed @type %title from front page.', array('@type' => node_type_get_name($node), '%title' => node_get_original_title($node))); } /** @@ -3033,7 +3033,7 @@ */ function node_save_action($node) { node_save($node); - watchdog('action', 'Saved @type %title', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])); + watchdog('action', 'Saved @type %title', array('@type' => node_type_get_name($node), '%title' => node_get_original_title($node))); } /** @@ -3043,7 +3043,7 @@ function node_assign_owner_action($node, $context) { $node->uid = $context['owner_uid']; $owner_name = db_query("SELECT name FROM {users} WHERE uid = :uid", array(':uid' => $context['owner_uid']))->fetchField(); - watchdog('action', 'Changed owner of @type %title to uid %name.', array('@type' => node_type_get_type($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'], '%name' => $owner_name)); + watchdog('action', 'Changed owner of @type %title to uid %name.', array('@type' => node_type_get_type($node), '%title' => node_get_original_title($node), '%name' => $owner_name)); } function node_assign_owner_action_form($context) { @@ -3124,7 +3124,7 @@ foreach ($context['keywords'] as $keyword) { if (strpos(drupal_render(node_build(clone $node)), $keyword) !== FALSE || strpos($node->title, $keyword) !== FALSE) { $node->status = NODE_NOT_PUBLISHED; - watchdog('action', 'Set @type %title to unpublished.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])); + watchdog('action', 'Set @type %title to unpublished.', array('@type' => node_type_get_name($node), '%title' => node_get_original_title($node))); break; } } @@ -3156,6 +3156,26 @@ return $requirements; } +function node_get_original_title($node) { + if (isset($node->language)) { + $langcode = field_multilingual_valid_language($node->language); + } + else { + $langcode = FIELD_LANGUAGE_NONE; + } + return $node->title[$langcode][0]['value']; +} + +function node_get_translated_title($node) { + if (! isset($node->content['title'])) { + $content = node_build($node, 'full'); + } + else { + $content = $node->content; + } + return $content['title']['items'][0]['#item']['value']; +} + /** * Controller class for nodes. * Index: modules/node/node.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.admin.inc,v retrieving revision 1.71 diff -u -r1.71 node.admin.inc --- modules/node/node.admin.inc 11 Oct 2009 03:07:18 -0000 1.71 +++ modules/node/node.admin.inc 14 Oct 2009 17:35:14 -0000 @@ -339,7 +339,7 @@ $node = _node_mass_update_helper($nid, $updates); // Store result for post-processing in the finished callback. - $context['results'][] = l($node->title[FIELD_LANGUAGE_NONE][0]['value'], 'node/' . $node->nid); + $context['results'][] = l(node_get_original_title($node), 'node/' . $node->nid); // Update our progress information. $context['sandbox']['progress']++; Index: modules/poll/poll.module =================================================================== RCS file: /cvs/drupal/drupal/modules/poll/poll.module,v retrieving revision 1.317 diff -u -r1.317 poll.module --- modules/poll/poll.module 11 Oct 2009 03:07:19 -0000 1.317 +++ modules/poll/poll.module 14 Oct 2009 17:35:17 -0000 @@ -708,7 +708,7 @@ function template_preprocess_poll_vote(&$variables) { $form = $variables['form']; $variables['choice'] = drupal_render($form['choice']); - $variables['title'] = check_plain($form['#node']->title[FIELD_LANGUAGE_NONE][0]['value']); + $variables['title'] = check_plain(node_get_translated_title($form['#node'])); $variables['vote'] = drupal_render($form['vote']); $variables['rest'] = drupal_render_children($form); $variables['block'] = $form['#block']; @@ -740,7 +740,7 @@ } } - return theme('poll_results', array('raw_title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'], 'results' => $poll_results, 'votes' => $total_votes, 'raw_links' => isset($node->links) ? $node->links : array(), 'block' => $block, 'nid' => $node->nid, 'vote' => isset($node->vote) ? $node->vote : NULL)); + return theme('poll_results', array('raw_title' => node_get_original_title($node), 'results' => $poll_results, 'votes' => $total_votes, 'raw_links' => isset($node->links) ? $node->links : array(), 'block' => $block, 'nid' => $node->nid, 'vote' => isset($node->vote) ? $node->vote : NULL)); } Index: modules/poll/poll.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/poll/poll.pages.inc,v retrieving revision 1.22 diff -u -r1.22 poll.pages.inc --- modules/poll/poll.pages.inc 11 Oct 2009 03:07:19 -0000 1.22 +++ modules/poll/poll.pages.inc 14 Oct 2009 17:35:17 -0000 @@ -51,7 +51,7 @@ */ function poll_votes($node) { $votes_per_page = 20; - drupal_set_title($node->title[FIELD_LANGUAGE_NONE][0]['value']); + drupal_set_title(node_get_translated_title($node)); $header[] = array('data' => t('Visitor'), 'field' => 'u.name'); $header[] = array('data' => t('Vote'), 'field' => 'pc.chtext'); @@ -91,7 +91,7 @@ * Callback for the 'results' tab for polls you can vote on */ function poll_results($node) { - drupal_set_title($node->title[FIELD_LANGUAGE_NONE][0]['value']); + drupal_set_title(node_get_translated_title($node)); $node->show_results = TRUE; return node_show($node); } Index: modules/book/book.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.admin.inc,v retrieving revision 1.24 diff -u -r1.24 book.admin.inc --- modules/book/book.admin.inc 11 Oct 2009 03:07:16 -0000 1.24 +++ modules/book/book.admin.inc 14 Oct 2009 17:35:12 -0000 @@ -78,7 +78,7 @@ * @ingroup forms. */ function book_admin_edit($form, $form_state, $node) { - drupal_set_title($node->title[FIELD_LANGUAGE_NONE][0]['value']); + drupal_set_title(node_get_original_title($node)); $form['#node'] = $node; _book_admin_table($node, $form); $form['save'] = array( @@ -131,7 +131,7 @@ // Update the title if changed. if ($row['title']['#default_value'] != $values['title']) { $node = node_load($values['nid'], FALSE); - $langcode = FIELD_LANGUAGE_NONE; + $langcode = field_multilingual_valid_language($node->language); $node->title = array($langcode => array(array('value' => $values['title']))); $node->book['link_title'] = $values['title']; $node->revision = 1; Index: modules/book/book.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.pages.inc,v retrieving revision 1.18 diff -u -r1.18 book.pages.inc --- modules/book/book.pages.inc 11 Oct 2009 03:07:17 -0000 1.18 +++ modules/book/book.pages.inc 14 Oct 2009 17:35:13 -0000 @@ -90,7 +90,7 @@ * Menu callback; show the outline form for a single node. */ function book_outline($node) { - drupal_set_title($node->title[FIELD_LANGUAGE_NONE][0]['value']); + drupal_set_title(node_get_original_title($node)); return drupal_get_form('book_outline_form', $node); } @@ -188,7 +188,7 @@ */ function book_remove_form($form, &$form_state, $node) { $form['#node'] = $node; - $title = array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']); + $title = array('%title' => node_get_original_title($node)); if ($node->book['has_children']) { $description = t('%title has associated child pages, which will be relocated automatically to maintain their connection to the book. To recreate the hierarchy (as it was before removing this page), %title may be added again using the Outline tab, and each of its former child pages will need to be relocated manually.', $title); Index: modules/book/book.module =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.module,v retrieving revision 1.518 diff -u -r1.518 book.module --- modules/book/book.module 11 Oct 2009 03:07:17 -0000 1.518 +++ modules/book/book.module 14 Oct 2009 17:35:13 -0000 @@ -477,7 +477,7 @@ if (isset($node->nid) && ($nid == $node->book['original_bid']) && ($node->book['parent_depth_limit'] == 0)) { // This is the top level node in a maximum depth book and thus cannot be moved. - $options[$node->nid] = $node->title[FIELD_LANGUAGE_NONE][0]['value']; + $options[$node->nid] = node_get_original_title($node); } else { foreach (book_get_books() as $book) { @@ -526,7 +526,7 @@ $new = empty($node->book['mlid']); $node->book['link_path'] = 'node/' . $node->nid; - $node->book['link_title'] = $node->title[FIELD_LANGUAGE_NONE][0]['value']; + $node->book['link_title'] = node_get_original_title($node); $node->book['parent_mismatch'] = FALSE; // The normal case. if ($node->book['bid'] == $node->nid) { @@ -882,7 +882,7 @@ if (isset($node->book) && $node->book['has_children']) { $form['book_warning'] = array( - '#markup' => '

' . t('%title is part of a book outline, and has associated child pages. If you proceed with deletion, the child pages will be relocated automatically.', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])) . '

', + '#markup' => '

' . t('%title is part of a book outline, and has associated child pages. If you proceed with deletion, the child pages will be relocated automatically.', array('%title' => node_get_original_title($node))) . '

', '#weight' => -10, ); } @@ -1103,7 +1103,7 @@ */ function template_preprocess_book_node_export_html(&$variables) { $variables['depth'] = $variables['node']->book['depth']; - $variables['title'] = check_plain($variables['node']->title[FIELD_LANGUAGE_NONE][0]['value']); + $variables['title'] = check_plain(node_get_translated_title($variables['node'])); $variables['content'] = $variables['node']->rendered; } Index: modules/translation/translation.test =================================================================== RCS file: /cvs/drupal/drupal/modules/translation/translation.test,v retrieving revision 1.19 diff -u -r1.19 translation.test --- modules/translation/translation.test 11 Oct 2009 03:07:21 -0000 1.19 +++ modules/translation/translation.test 14 Oct 2009 17:35:17 -0000 @@ -129,7 +129,7 @@ function createPage($title, $body, $language) { $edit = array(); $langcode = FIELD_LANGUAGE_NONE; - $edit["title[$langcode][0][value]"] = $title; + $edit["title[$language][0][value]"] = $title; $edit["body[$langcode][0][value]"] = $body; $edit['language'] = $language; $this->drupalPost('node/add/page', $edit, t('Save')); Index: modules/translation/translation.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/translation/translation.pages.inc,v retrieving revision 1.10 diff -u -r1.10 translation.pages.inc --- modules/translation/translation.pages.inc 11 Oct 2009 03:07:21 -0000 1.10 +++ modules/translation/translation.pages.inc 14 Oct 2009 17:35:17 -0000 @@ -33,7 +33,7 @@ // Existing translation in the translation set: display status. // We load the full node to check whether the user can edit it. $translation_node = node_load($translations[$language->language]->nid); - $title = l($translation_node->title[FIELD_LANGUAGE_NONE][0]['value'], 'node/' . $translation_node->nid); + $title = l(node_get_original_title($translation_node), 'node/' . $translation_node->nid); if (node_access('update', $translation_node)) { $options[] = l(t('edit'), "node/$translation_node->nid/edit"); } @@ -54,7 +54,7 @@ $rows[] = array($language_name, $title, $status, implode(" | ", $options)); } - drupal_set_title(t('Translations of %title', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), PASS_THROUGH); + drupal_set_title(t('Translations of %title', array('%title' => node_get_original_title($node))), PASS_THROUGH); $build['translation_node_overview'] = array( '#theme' => 'table', Index: modules/translation/translation.module =================================================================== RCS file: /cvs/drupal/drupal/modules/translation/translation.module,v retrieving revision 1.62 diff -u -r1.62 translation.module --- modules/translation/translation.module 11 Oct 2009 03:07:21 -0000 1.62 +++ modules/translation/translation.module 14 Oct 2009 17:35:17 -0000 @@ -202,7 +202,7 @@ $translations = translation_node_get_translations($source_node->tnid); if (isset($translations[$language])) { $languages = language_list(); - drupal_set_message(t('A translation of %title in %language already exists, a new %type will be created instead of a translation.', array('%title' => $source_node->title[FIELD_LANGUAGE_NONE][0]['value'], '%language' => $languages[$language]->name, '%type' => $node->type)), 'error'); + drupal_set_message(t('A translation of %title in %language already exists, a new %type will be created instead of a translation.', array('%title' => node_get_original_title($source_node), '%language' => $languages[$language]->name, '%type' => $node->type)), 'error'); return; } } Index: modules/system/system.tokens.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.tokens.inc,v retrieving revision 1.4 diff -u -r1.4 system.tokens.inc --- modules/system/system.tokens.inc 11 Oct 2009 03:07:20 -0000 1.4 +++ modules/system/system.tokens.inc 14 Oct 2009 17:35:17 -0000 @@ -283,7 +283,7 @@ case 'node': if ($nid = $file->nid) { $node = node_load($file->nid); - $replacements[$original] = $sanitize ? filter_xss($node->title[FIELD_LANGUAGE_NONE][0]['value']) : $node->title[FIELD_LANGUAGE_NONE][0]['value']; + $replacements[$original] = $sanitize ? filter_xss(node_get_original_title($node)) : node_get_original_title($node); } break;