Index: modules/book/book.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.admin.inc,v retrieving revision 1.24 diff -u -p -r1.24 book.admin.inc --- modules/book/book.admin.inc 11 Oct 2009 03:07:16 -0000 1.24 +++ modules/book/book.admin.inc 17 Oct 2009 10:34:05 -0000 @@ -78,7 +78,7 @@ function book_admin_settings_validate($f * @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 @@ function book_admin_edit_submit($form, & // 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.module =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.module,v retrieving revision 1.519 diff -u -p -r1.519 book.module --- modules/book/book.module 15 Oct 2009 14:07:26 -0000 1.519 +++ modules/book/book.module 17 Oct 2009 10:34:05 -0000 @@ -478,7 +478,7 @@ function _book_add_form_elements(&$form, 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) { @@ -527,7 +527,7 @@ function _book_update_outline($node) { $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) { @@ -883,7 +883,7 @@ function book_form_node_delete_confirm_a 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, ); } @@ -1104,7 +1104,7 @@ function book_node_export($node, $childr */ 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/book/book.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/book/book.pages.inc,v retrieving revision 1.19 diff -u -p -r1.19 book.pages.inc --- modules/book/book.pages.inc 15 Oct 2009 14:07:27 -0000 1.19 +++ modules/book/book.pages.inc 17 Oct 2009 10:34:05 -0000 @@ -90,7 +90,7 @@ function book_export_html($nid) { * 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_outline_form_submit($form, */ 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/comment/comment.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.pages.inc,v retrieving revision 1.27 diff -u -p -r1.27 comment.pages.inc --- modules/comment/comment.pages.inc 16 Oct 2009 20:40:05 -0000 1.27 +++ modules/comment/comment.pages.inc 17 Oct 2009 10:34:04 -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.6 diff -u -p -r1.6 comment.tokens.inc --- modules/comment/comment.tokens.inc 16 Oct 2009 20:40:05 -0000 1.6 +++ modules/comment/comment.tokens.inc 17 Oct 2009 10:34:04 -0000 @@ -209,7 +209,8 @@ function comment_tokens($type, $tokens, 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/locale/locale.test =================================================================== RCS file: /cvs/drupal/drupal/modules/locale/locale.test,v retrieving revision 1.48 diff -u -p -r1.48 locale.test --- modules/locale/locale.test 17 Oct 2009 05:50:28 -0000 1.48 +++ modules/locale/locale.test 17 Oct 2009 16:10:56 -0000 @@ -1310,7 +1310,7 @@ class LocaleContentFunctionalTest extend } function setUp() { - parent::setUp('locale'); + parent::setUp('locale', 'locale_test'); } /** @@ -1394,11 +1394,15 @@ class LocaleContentFunctionalTest extend $this->assertNoText($name_disabled, t('Disabled language not present.')); // Create page content. + variable_set('locale_test_entity_info_alter', TRUE); + field_info_cache_clear(); + drupal_static_reset('language_list'); + $node_title = $this->randomName(); $node_body = $this->randomName(); $edit = array( 'type' => 'page', - 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $node_title))), + 'title' => array($langcode => array(array('value' => $node_title))), 'body' => array($langcode => array(array('value' => $node_body))), 'language' => $langcode, ); @@ -1681,15 +1685,17 @@ class LocaleMultilingualFieldsFunctional // Change node language. $this->drupalGet("node/$node->nid/edit"); $edit = array( - $title_key => $this->randomName(8), 'language' => 'it' ); $this->drupalPost(NULL, $edit, t('Save')); - $node = $this->drupalGetNodeByTitle($edit[$title_key]); + $node = $this->drupalGetNodeByTitle($title_value); $this->assertTrue($node, t('Node found in database.')); - + // Test title field + $assert = isset($node->title['it']) && !isset($node->title['en']) && $node->title['it'][0]['value'] == $title_value; + $this->assertTrue($assert, t('Field title language correctly changed.')); + // Test body field $assert = isset($node->body['it']) && !isset($node->body['en']) && $node->body['it'][0]['value'] == $body_value; - $this->assertTrue($assert, t('Field language correctly changed.')); + $this->assertTrue($assert, t('Field body language correctly changed.')); } } Index: modules/locale/tests/locale_test.module =================================================================== RCS file: /cvs/drupal/drupal/modules/locale/tests/locale_test.module,v retrieving revision 1.4 diff -u -p -r1.4 locale_test.module --- modules/locale/tests/locale_test.module 18 Aug 2009 11:22:36 -0000 1.4 +++ modules/locale/tests/locale_test.module 17 Oct 2009 15:31:44 -0000 @@ -25,3 +25,12 @@ function locale_test_boot() { $_SERVER['HTTP_HOST'] = variable_get('locale_test_domain'); } } + +/** + * Implement hook_entity_info_alter(). + */ +function locale_test_entity_info_alter(&$entity_info) { + if (variable_get('locale_test_entity_info_alter', FALSE)) { + $entity_info['node']['translation']['locale'] = TRUE; + } +} \ No newline at end of file Index: modules/node/node.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.admin.inc,v retrieving revision 1.71 diff -u -p -r1.71 node.admin.inc --- modules/node/node.admin.inc 11 Oct 2009 03:07:18 -0000 1.71 +++ modules/node/node.admin.inc 17 Oct 2009 15:39:26 -0000 @@ -339,7 +339,7 @@ function _node_mass_update_batch_process $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/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.1150 diff -u -p -r1.1150 node.module --- modules/node/node.module 17 Oct 2009 05:50:29 -0000 1.1150 +++ modules/node/node.module 17 Oct 2009 16:24:44 -0000 @@ -580,6 +580,7 @@ function node_configure_fields($type) { $field = array( 'field_name' => 'title', 'type' => 'text', + 'translatable' => TRUE, ); $field = field_create_field($field); } @@ -939,8 +940,7 @@ function node_save($node) { // 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) { @@ -1164,7 +1164,7 @@ function node_build_content($node, $buil $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( @@ -1238,7 +1238,7 @@ function node_language_provider($languag */ 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. @@ -1272,7 +1272,7 @@ function template_preprocess_node(&$vari $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)) { @@ -1522,7 +1522,7 @@ function node_search_execute($keys = NUL $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, @@ -2008,7 +2008,7 @@ function node_feed($nids = FALSE, $chann $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( @@ -2147,7 +2147,7 @@ function _node_index_node($node) { 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); @@ -2991,7 +2991,7 @@ function node_action_info() { */ 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))); } /** @@ -3000,7 +3000,7 @@ function node_publish_action($node, $con */ 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))); } /** @@ -3009,7 +3009,7 @@ function node_unpublish_action($node, $c */ 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))); } /** @@ -3018,7 +3018,7 @@ function node_make_sticky_action($node, */ 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))); } /** @@ -3027,7 +3027,7 @@ function node_make_unsticky_action($node */ 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))); } /** @@ -3036,7 +3036,7 @@ function node_promote_action($node, $con */ 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))); } /** @@ -3045,7 +3045,7 @@ function node_unpromote_action($node, $c */ 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))); } /** @@ -3055,7 +3055,7 @@ function node_save_action($node) { 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) { @@ -3136,7 +3136,7 @@ function node_unpublish_by_keyword_actio 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; } } @@ -3169,6 +3169,42 @@ function node_requirements($phase) { } /** + * Get the title value in the node language. + * + * @param $node + * The $node on wich get the title. + * @return + * The title value in the node language. + */ +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']; +} + +/** + * Get the builded (translated) title value. + * + * @param $node + * The $node on wich get the title. + * @return + * The builded (translated) title 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. * * This extends the DrupalDefaultEntityController class, adding required @@ -3180,9 +3216,7 @@ class NodeController extends DrupalDefau // object type specific callback. $typed_nodes = array(); foreach ($nodes as $id => $object) { - if (isset($object->title)) { - $object->title = array(FIELD_LANGUAGE_NONE => array(array('value' => $object->title))); - } + unset($object->title); $typed_nodes[$object->type][$id] = $object; } Index: modules/node/node.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v retrieving revision 1.92 diff -u -p -r1.92 node.pages.inc --- modules/node/node.pages.inc 16 Oct 2009 19:20:34 -0000 1.92 +++ modules/node/node.pages.inc 17 Oct 2009 12:23:09 -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); } @@ -419,8 +419,8 @@ function node_form_submit($form, &$form_ $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); @@ -469,7 +469,7 @@ function node_delete_confirm($form, &$fo ); 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))), 'node/' . $node->nid, t('This action cannot be undone.'), t('Delete'), @@ -484,8 +484,8 @@ function node_delete_confirm_submit($for 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'] = ''; @@ -495,7 +495,7 @@ function node_delete_confirm_submit($for * 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)); @@ -557,8 +557,8 @@ function node_revision_revert_confirm_su 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'; } @@ -571,8 +571,8 @@ function node_revision_delete_confirm_su $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.test =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.test,v retrieving revision 1.49 diff -u -p -r1.49 node.test --- modules/node/node.test 16 Oct 2009 23:48:37 -0000 1.49 +++ modules/node/node.test 17 Oct 2009 10:34:04 -0000 @@ -967,9 +967,9 @@ class NodeAdminTestCase extends DrupalWe * 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 -p -r1.4 node.tokens.inc --- modules/node/node.tokens.inc 11 Oct 2009 03:07:18 -0000 1.4 +++ modules/node/node.tokens.inc 17 Oct 2009 10:34:04 -0000 @@ -134,7 +134,7 @@ function node_tokens($type, $tokens, arr 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/path/path.test =================================================================== RCS file: /cvs/drupal/drupal/modules/path/path.test,v retrieving revision 1.24 diff -u -p -r1.24 path.test --- modules/path/path.test 16 Oct 2009 02:04:43 -0000 1.24 +++ modules/path/path.test 17 Oct 2009 10:40:27 -0000 @@ -216,7 +216,6 @@ class PathLanguageTestCase extends Drupa $edit = array(); $langcode = 'fr'; $edit["body[$langcode][0][value]"] = $this->randomName(); - $langcode = FIELD_LANGUAGE_NONE; $edit["title[$langcode][0][value]"] = $this->randomName(); $edit['path'] = $this->randomName(); $this->drupalPost(NULL, $edit, t('Save')); @@ -231,7 +230,7 @@ class PathLanguageTestCase extends Drupa // Confirm that the alias works. $this->drupalGet('fr/' . $edit['path']); - $this->assertText($french_node->title[FIELD_LANGUAGE_NONE][0]['value'], 'Alias for French translation works.'); + $this->assertText($french_node->title['fr'][0]['value'], 'Alias for French translation works.'); // Confirm that the alias is returned by url(). drupal_static_reset('language_list'); Index: modules/poll/poll.module =================================================================== RCS file: /cvs/drupal/drupal/modules/poll/poll.module,v retrieving revision 1.319 diff -u -p -r1.319 poll.module --- modules/poll/poll.module 16 Oct 2009 19:06:24 -0000 1.319 +++ modules/poll/poll.module 17 Oct 2009 10:34:05 -0000 @@ -711,7 +711,7 @@ function poll_vote($form, &$form_state) 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']; @@ -743,7 +743,7 @@ function poll_view_results($node, $build } } - 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.23 diff -u -p -r1.23 poll.pages.inc --- modules/poll/poll.pages.inc 16 Oct 2009 19:06:24 -0000 1.23 +++ modules/poll/poll.pages.inc 17 Oct 2009 10:34:05 -0000 @@ -51,7 +51,7 @@ function poll_page() { */ 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'); @@ -92,7 +92,7 @@ function poll_votes($node) { * 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/system/system.tokens.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.tokens.inc,v retrieving revision 1.4 diff -u -p -r1.4 system.tokens.inc --- modules/system/system.tokens.inc 11 Oct 2009 03:07:20 -0000 1.4 +++ modules/system/system.tokens.inc 17 Oct 2009 10:34:05 -0000 @@ -283,7 +283,7 @@ function system_tokens($type, $tokens, a 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; Index: modules/translation/translation.module =================================================================== RCS file: /cvs/drupal/drupal/modules/translation/translation.module,v retrieving revision 1.62 diff -u -p -r1.62 translation.module --- modules/translation/translation.module 11 Oct 2009 03:07:21 -0000 1.62 +++ modules/translation/translation.module 17 Oct 2009 10:34:05 -0000 @@ -202,7 +202,7 @@ function translation_node_prepare($node) $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/translation/translation.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/translation/translation.pages.inc,v retrieving revision 1.10 diff -u -p -r1.10 translation.pages.inc --- modules/translation/translation.pages.inc 11 Oct 2009 03:07:21 -0000 1.10 +++ modules/translation/translation.pages.inc 17 Oct 2009 10:34:05 -0000 @@ -33,7 +33,7 @@ function translation_node_overview($node // 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 @@ function translation_node_overview($node $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.test =================================================================== RCS file: /cvs/drupal/drupal/modules/translation/translation.test,v retrieving revision 1.20 diff -u -p -r1.20 translation.test --- modules/translation/translation.test 16 Oct 2009 02:04:44 -0000 1.20 +++ modules/translation/translation.test 17 Oct 2009 10:42:52 -0000 @@ -154,8 +154,7 @@ class TranslationTestCase extends Drupal $this->drupalGet('node/add/page', array('query' => array('translation' => $nid, 'language' => $language))); $edit = array(); - $langcode = FIELD_LANGUAGE_NONE; - $edit["title[$langcode][0][value]"] = $title; + $edit["title[$language][0][value]"] = $title; $edit["body[$language][0][value]"] = $body; $this->drupalPost(NULL, $edit, t('Save')); $this->assertRaw(t('Page %title has been created.', array('%title' => $title)), t('Translation created.'));