Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.1192
diff -u -p -r1.1192 common.inc
--- includes/common.inc	16 Jul 2010 02:37:05 -0000	1.1192
+++ includes/common.inc	16 Jul 2010 08:44:00 -0000
@@ -1997,8 +1997,8 @@ function format_username($account) {
  *   - 'external': Whether the given path is an external URL.
  *   - 'language': An optional language object. If the path being linked to is
  *     internal to the site, $options['language'] is used to look up the alias
- *     for the URL. If $options['language'] is omitted, the global
- *     $language_content will be used.
+ *     for the URL. If $options['language'] is omitted, the global $language_url
+ *     will be used.
  *   - 'https': Whether this URL should point to a secure location. If not
  *     defined, the current scheme is used, so the user stays on http or https
  *     respectively. TRUE enforces HTTPS and FALSE enforces HTTP, but HTTPS can
Index: includes/path.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/path.inc,v
retrieving revision 1.65
diff -u -p -r1.65 path.inc
--- includes/path.inc	16 Jul 2010 02:51:44 -0000	1.65
+++ includes/path.inc	16 Jul 2010 08:42:42 -0000
@@ -44,7 +44,7 @@ function drupal_path_initialize() {
  *   found.
  */
 function drupal_lookup_path($action, $path = '', $path_language = NULL) {
-  global $language_content;
+  global $language_url;
   // Use the advanced drupal_static() pattern, since this is called very often.
   static $drupal_static_fast;
   if (!isset($drupal_static_fast)) {
@@ -71,7 +71,7 @@ function drupal_lookup_path($action, $pa
     }
   }
 
-  $path_language = $path_language ? $path_language : $language_content->language;
+  $path_language = $path_language ? $path_language : $language_url->language;
 
   if ($action == 'wipe') {
     $cache = array();
Index: modules/locale/locale.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.test,v
retrieving revision 1.73
diff -u -p -r1.73 locale.test
--- modules/locale/locale.test	26 Jun 2010 19:55:47 -0000	1.73
+++ modules/locale/locale.test	16 Jul 2010 08:42:42 -0000
@@ -1452,9 +1452,9 @@ class LocalePathFunctionalTest extends D
     );
     $this->drupalPost('admin/config/regional/language/add', $edit, t('Add custom language'));
 
-    // Set language negotiation.
-    drupal_load('module', 'locale');
-    variable_set('language_negotiation_' . LANGUAGE_TYPE_CONTENT, locale_language_negotiation_info());
+    // Enable URL language detection and selection.
+    $edit = array('language[enabled][locale-url]' => 1);
+    $this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
 
     // Create a node.
     $node = $this->drupalCreateNode(array('type' => 'page'));
Index: modules/path/path.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/path/path.test,v
retrieving revision 1.35
diff -u -p -r1.35 path.test
--- modules/path/path.test	26 Mar 2010 12:37:30 -0000	1.35
+++ modules/path/path.test	16 Jul 2010 08:42:42 -0000
@@ -242,8 +242,8 @@ class PathLanguageTestCase extends Drupa
     parent::setUp('path', 'locale', 'translation');
 
     // Create and login user.
-    $web_user = $this->drupalCreateUser(array('edit any page content', 'create page content', 'administer url aliases', 'create url aliases', 'administer languages', 'translate content', 'access administration pages'));
-    $this->drupalLogin($web_user);
+    $this->web_user = $this->drupalCreateUser(array('edit any page content', 'create page content', 'administer url aliases', 'create url aliases', 'administer languages', 'translate content', 'access administration pages'));
+    $this->drupalLogin($this->web_user);
 
     // Enable French language.
     $edit = array();
@@ -251,13 +251,9 @@ class PathLanguageTestCase extends Drupa
 
     $this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
 
-    // Set language negotiation to "Path prefix with fallback".
-    include_once DRUPAL_ROOT . '/includes/locale.inc';
-    variable_set('language_negotiation_' . LANGUAGE_TYPE_CONTENT, locale_language_negotiation_info());
-    variable_set('locale_language_negotiation_url_part', LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX);
-
-    // Force inclusion of language.inc.
-    drupal_language_initialize();
+    // Enable URL language detection and selection.
+    $edit = array('language[enabled][locale-url]' => 1);
+    $this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
   }
 
   /**
@@ -268,26 +264,26 @@ class PathLanguageTestCase extends Drupa
     variable_set('language_content_type_page', 2);
 
     $english_node = $this->drupalCreateNode(array('type' => 'page'));
+    $english_alias = $this->randomName();
 
     // Edit the node to set language and path.
     $edit = array();
     $edit['language'] = 'en';
-    $edit['path[alias]'] = $this->randomName();
+    $edit['path[alias]'] = $english_alias;
     $this->drupalPost('node/' . $english_node->nid . '/edit', $edit, t('Save'));
 
     // Confirm that the alias works.
-    $this->drupalGet($edit['path[alias]']);
+    $this->drupalGet($english_alias);
     $this->assertText($english_node->title, 'Alias works.');
 
     // Translate the node into French.
     $this->drupalGet('node/' . $english_node->nid . '/translate');
     $this->clickLink(t('add translation'));
     $edit = array();
-    $langcode = 'fr';
-    $edit["body[$langcode][0][value]"] = $this->randomName();
-    $langcode = LANGUAGE_NONE;
     $edit["title"] = $this->randomName();
-    $edit['path[alias]'] = $this->randomName();
+    $edit["body[fr][0][value]"] = $this->randomName();
+    $french_alias = $this->randomName();
+    $edit['path[alias]'] = $french_alias;
     $this->drupalPost(NULL, $edit, t('Save'));
 
     // Clear the path lookup cache.
@@ -306,6 +302,40 @@ class PathLanguageTestCase extends Drupa
     $languages = language_list();
     $url = url('node/' . $french_node->nid, array('language' => $languages[$french_node->language]));
     $this->assertTrue(strpos($url, $edit['path[alias]']), t('URL contains the path alias.'));
+
+    // Confirm that the alias works even when changing language negotiation
+    // options. Enable User language detection and selection over URL one.
+    $edit = array(
+      'language[enabled][locale-user]' => 1,
+      'language[weight][locale-user]' => -9,
+      'language[enabled][locale-url]' => 1,
+      'language[weight][locale-url]' => -8,
+    );
+    $this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
+
+    // Change user language preference.
+    $edit = array('language' => 'fr');
+    $this->drupalPost("user/{$this->web_user->uid}/edit", $edit, t('Save'));
+
+    // Check that the English alias works.
+    $this->drupalGet($english_alias);
+    $this->assertText($english_node->title, 'Alias for English translation works.');
+
+    // Check that the French alias works.
+    $this->drupalGet("fr/$french_alias");
+    $this->assertText($french_node->title, 'Alias for French translation works.');
+
+    // Disable URL language negotiation.
+    $edit = array('language[enabled][locale-url]' => FALSE);
+    $this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
+
+    // Check that the English alias still works.
+    $this->drupalGet($english_alias);
+    $this->assertText($english_node->title, 'Alias for English translation works.');
+
+    // Check that the French alias is not available.
+    $this->drupalGet($french_alias);
+    $this->assertResponse(404, t('Alias for French translation is unavailable when URL language negotiation is disabled.'));
   }
 }
 
@@ -334,13 +364,9 @@ class PathLanguageUITestCase extends Dru
 
     $this->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
 
-    // Set language negotiation to "Path prefix with fallback".
-    include_once DRUPAL_ROOT . '/includes/locale.inc';
-    variable_set('language_negotiation_' . LANGUAGE_TYPE_CONTENT, locale_language_negotiation_info());
-    variable_set('locale_language_negotiation_url_part', LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX);
-
-    // Force inclusion of language.inc.
-    drupal_language_initialize();
+    // Enable URL language detection and selection.
+    $edit = array('language[enabled][locale-url]' => 1);
+    $this->drupalPost('admin/config/regional/language/configure', $edit, t('Save settings'));
   }
 
   /**
