Index: modules/locale/locale.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v
retrieving revision 1.198
diff -u -p -r1.198 locale.module
--- modules/locale/locale.module	4 Nov 2007 11:10:09 -0000	1.198
+++ modules/locale/locale.module	22 Nov 2007 00:58:01 -0000
@@ -236,7 +236,7 @@ function locale_form_alter(&$form, $form
         '#options' => array('' => t('All languages')) + locale_language_list('name'),
         '#default_value' => $form['language']['#value'],
         '#weight' => -10,
-        '#description' => t('Path aliases added for languages take precedence over path aliases added for all languages for the same Drupal path.'),
+        '#description' => t('URL aliases added for languages take precedence over URL aliases added for all languages for the same Drupal path.'),
       );
       break;
 
Index: modules/path/path.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/path/path.admin.inc,v
retrieving revision 1.5
diff -u -p -r1.5 path.admin.inc
--- modules/path/path.admin.inc	10 Nov 2007 12:08:22 -0000	1.5
+++ modules/path/path.admin.inc	22 Nov 2007 00:58:01 -0000
@@ -27,8 +27,8 @@ function path_admin_overview($keys = NUL
     $sql = 'SELECT * FROM {url_alias}';
   }
   $header = array(
-    array('data' => t('Alias'), 'field' => 'dst', 'sort' => 'asc'),
-    array('data' => t('System'), 'field' => 'src'),
+    array('data' => t('URL Alias'), 'field' => 'dst', 'sort' => 'asc'),
+    array('data' => t('System URL'), 'field' => 'src'),
     array('data' => t('Operations'), 'colspan' => '2')
   );
   if ($multilanguage) {
@@ -67,7 +67,7 @@ function path_admin_overview($keys = NUL
 function path_admin_edit($pid = 0) {
   if ($pid) {
     $alias = path_load($pid);
-    drupal_set_title(check_plain($alias['dst']));
+    drupal_set_title(t('Edit URL alias'));
     $output = drupal_get_form('path_admin_form', $alias);
   }
   else {
@@ -90,21 +90,21 @@ function path_admin_form(&$form_state, $
 
   $form['src'] = array(
     '#type' => 'textfield',
-    '#title' => t('Existing system path'),
+    '#title' => t('Existing system URL'),
     '#default_value' => $edit['src'],
     '#maxlength' => 64,
     '#size' => 45,
-    '#description' => t('Specify the existing path you wish to alias. For example: node/28, forum/1, taxonomy/term/1+2.'),
+    '#description' => t('Specify the existing URL you wish to alias. For example: node/28, forum/1, taxonomy/term/1+2.'),
     '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='),
     '#required' => TRUE,
   );
   $form['dst'] = array(
     '#type' => 'textfield',
-    '#title' => t('Path alias'),
+    '#title' => t('URL alias'),
     '#default_value' => $edit['dst'],
     '#maxlength' => 64,
     '#size' => 45,
-    '#description' => t('Specify an alternative path by which this data can be accessed. For example, type "about" when writing an about page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'),
+    '#description' => t('Specify an alternative URL by which this page can be accessed. For example, type "about" when writing an about page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'),
     '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='),
     '#required' => TRUE,
   );
@@ -151,7 +151,6 @@ function path_admin_form_submit($form, &
   // Language is only set if locale module is enabled
   path_set_alias($form_state['values']['src'], $form_state['values']['dst'], isset($form_state['values']['pid']) ? $form_state['values']['pid'] : 0, isset($form_state['values']['language']) ? $form_state['values']['language'] : '');
 
-  drupal_set_message(t('The alias has been saved.'));
   $form_state['redirect'] = 'admin/build/path';
   return;
 }
@@ -164,7 +163,7 @@ function path_admin_delete_confirm($form
   if (user_access('administer url aliases')) {
     $form['pid'] = array('#type' => 'value', '#value' => $pid);
     $output = confirm_form($form,
-      t('Are you sure you want to delete path alias %title?', array('%title' => $path['dst'])),
+      t('Are you sure you want to delete URL alias %title?', array('%title' => $path['dst'])),
       isset($_GET['destination']) ? $_GET['destination'] : 'admin/build/path');
   }
   return $output;
@@ -175,7 +174,7 @@ function path_admin_delete_confirm($form
  **/
 function path_admin_delete_confirm_submit($form, &$form_state) {
   if ($form_state['values']['confirm']) {
-    path_admin_delete($form_state['values']['pid']);
+    path_set_alias(NULL, NULL, $form_state['values']['pid']);
     $form_state['redirect'] = 'admin/build/path';
     return;
   }
@@ -191,7 +190,7 @@ function path_admin_delete_confirm_submi
 function path_admin_filter_form(&$form_state, $keys = '') {
   $form['#attributes'] = array('class' => 'search-form');
   $form['basic'] = array('#type' => 'fieldset',
-    '#title' => t('Filter aliases')
+    '#title' => t('Filter URL aliases')
   );
   $form['basic']['inline'] = array('#prefix' => '<div class="container-inline">', '#suffix' => '</div>');
   $form['basic']['inline']['filter'] = array(
Index: modules/path/path.info
===================================================================
RCS file: /cvs/drupal/drupal/modules/path/path.info,v
retrieving revision 1.4
diff -u -p -r1.4 path.info
--- modules/path/path.info	8 Jun 2007 05:50:55 -0000	1.4
+++ modules/path/path.info	22 Nov 2007 00:58:01 -0000
@@ -1,5 +1,5 @@
 ; $Id: path.info,v 1.4 2007/06/08 05:50:55 dries Exp $
-name = Path
+name = URL aliases
 description = Allows users to rename URLs.
 package = Core - optional
 version = VERSION
Index: modules/path/path.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/path/path.module,v
retrieving revision 1.132
diff -u -p -r1.132 path.module
--- modules/path/path.module	10 Nov 2007 12:08:22 -0000	1.132
+++ modules/path/path.module	22 Nov 2007 00:58:01 -0000
@@ -12,7 +12,7 @@
 function path_help($path, $arg) {
   switch ($path) {
     case 'admin/help#path':
-      $output = '<p>'. t('The path module allows you to specify aliases for Drupal URLs. Such aliases improve readability of URLs for your users and may help internet search engines to index your content more effectively. More than one alias may be created for a given page.') .'</p>';
+      $output = '<p>'. t('This module allows you to specify aliases for Drupal URLs. Such aliases improve readability of URLs for your users and may help internet search engines to index your content more effectively. More than one alias may be created for a given page.') .'</p>';
       $output .= t('<p>Some examples of URL aliases are:</p>
 <ul>
 <li>user/login =&gt; login</li>
@@ -21,12 +21,12 @@ function path_help($path, $arg) {
 <li>node/3 =&gt; contact</li>
 </ul>
 ');
-      $output .= '<p>'. t('The path module enables an extra field for aliases in all node input and editing forms (when users have the appropriate permissions). It also provides an interface to view and edit all URL aliases. The two permissions related to URL aliasing are "administer url aliases" and "create url aliases". ') .'</p>';
+      $output .= '<p>'. t('This module enables an extra field for aliases in all node input and editing forms when users have the appropriate permissions. It also provides an interface to view and edit all URL aliases. The two permissions related to URL aliasing are "administer url aliases" and "create url aliases". ') .'</p>';
       $output .= '<p>'. t('This module also comes with user-defined mass URL aliasing capabilities, which is useful if you wish to uniformly use URLs different from the default. For example, you may want to have your URLs presented in a different language. Access to the Drupal source code on the web server is required to set up these kinds of aliases. ') .'</p>';
-      $output .= '<p>'. t('For more information please read the configuration and customization handbook <a href="@path">Path page</a>.', array('@path' => 'http://drupal.org/handbook/modules/path/')) .'</p>';
+      $output .= '<p>'. t('For more information please read the configuration and customization handbook about <a href="@path">URL aliases</a>.', array('@path' => 'http://drupal.org/handbook/modules/path/')) .'</p>';
       return $output;
     case 'admin/build/path':
-      return '<p>'. t("Drupal provides users complete control over URLs through aliasing. This feature is typically used to make URLs human-readable or easy to remember. For example, one could map the relative URL 'node/1' onto 'about'. Each system path can have multiple aliases.") .'</p>';
+      return '<p>'. t("Drupal provides users complete control over URLs through aliasing. This feature is typically used to make URLs human-readable or easy to remember. For example, one could map the relative URL 'node/1' onto 'about'. Each system URL can have multiple aliases.") .'</p>';
     case 'admin/build/path/add':
       return '<p>'. t('Enter the path you wish to create the alias for, followed by the name of the new alias.') .'</p>';
   }
@@ -73,62 +73,50 @@ function path_menu() {
 }
 
 /**
- * Post-confirmation; delete an URL alias.
- */
-function path_admin_delete($pid = 0) {
-  db_query('DELETE FROM {url_alias} WHERE pid = %d', $pid);
-  drupal_set_message(t('The alias has been deleted.'));
-}
-
-/**
  * Set an aliased path for a given Drupal path, preventing duplicates.
  */
 function path_set_alias($path = NULL, $alias = NULL, $pid = NULL, $language = '') {
-  if ($path && !$alias) {
-    // Delete based on path
-    db_query("DELETE FROM {url_alias} WHERE src = '%s' AND language = '%s'", $path, $language);
-    drupal_clear_path_cache();
-  }
-  else if (!$path && $alias) {
-    // Delete based on alias
-    db_query("DELETE FROM {url_alias} WHERE dst = '%s' AND language = '%s'", $alias, $language);
-    drupal_clear_path_cache();
+  $path = urldecode($path);
+  $alias = urldecode($alias);
+  // First we check if we deal with an existing alias and delete or modify it based on pid.
+  if ($pid) {
+    // An existing alias.
+    if (!$path || !$alias) {
+      // Delete the alias based on pid.
+      db_query('DELETE FROM {url_alias} WHERE pid = %d', $pid);
+      drupal_set_message(t('The URL alias has been deleted.'));
+    }
+    else {
+      // Update the existing alias.
+      db_query("UPDATE {url_alias} SET src = '%s', dst = '%s', language = '%s' WHERE pid = %d", $path, $alias, $language, $pid);
+      drupal_set_message(t('The URL alias has been updated.'));
+    }
   }
   else if ($path && $alias) {
-    $path = urldecode($path);
-    $path_count = db_result(db_query("SELECT COUNT(src) FROM {url_alias} WHERE src = '%s' AND language = '%s'", $path, $language));
-    $alias = urldecode($alias);
-    // Alias count can only be 0 or 1.
-    $alias_count = db_result(db_query("SELECT COUNT(dst) FROM {url_alias} WHERE dst = '%s' AND language = '%s'", $alias, $language));
-
-    if ($alias_count == 0) {
-      if ($pid) {
-        // Existing path changed data
-        db_query("UPDATE {url_alias} SET src = '%s', dst = '%s', language = '%s' WHERE pid = %d", $path, $alias, $language, $pid);
-      }
-      else {
-        // No such alias yet in this language
-        db_query("INSERT INTO {url_alias} (src, dst, language) VALUES ('%s', '%s', '%s')", $path, $alias, $language);
-      }
+    // Check for existing aliases.
+    if ($alias == drupal_get_path_alias($path, $language)) {
+      // There is already such an alias, neutral or in this language.
+      // Update the alias based on alias; setting the language if not yet done.
+      db_query("UPDATE {url_alias} SET src = '%s', dst = '%s', language = '%s' WHERE dst = '%s'", $path, $alias, $language, $alias);
+      drupal_set_message(t('The URL alias has been updated.'));
     }
-    // The alias exists.
     else {
-      // This path has no alias yet, so we redirect the alias here.
-      if ($path_count == 0) {
-        db_query("UPDATE {url_alias} SET src = '%s' WHERE dst = '%s' AND language = '%s'", $path, $alias, $language);
-      }
-      else {
-        // This will delete the path that alias was originally pointing to.
-        path_set_alias(NULL, $alias, NULL, $language);
-        // This will remove the current aliases of the path.
-        path_set_alias($path, NULL, NULL, $language);
-        path_set_alias($path, $alias, NULL, $language);
-      }
+      // A new alias. Add it to the database.
+      db_query("INSERT INTO {url_alias} (src, dst, language) VALUES ('%s', '%s', '%s')", $path, $alias, $language);
+      drupal_set_message(t('The URL alias has been saved.'));
     }
-    if ($alias_count == 0 || $path_count == 0) {
-      drupal_clear_path_cache();
+  }
+  else {
+    // Delete the alias.
+    if ($alias) {
+      db_query("DELETE FROM {url_alias} WHERE dst = '%s'", $alias);
     }
+    else {
+      db_query("DELETE FROM {url_alias} WHERE src = '%s'", $path);
+    }  
+    drupal_set_message(t('The URL alias has been deleted.'));
   }
+  drupal_clear_path_cache();
 }
 
 /**
@@ -160,7 +148,7 @@ function path_nodeapi(&$node, $op, $arg)
         // Don't try to insert if path is NULL. We may have already set
         // the alias ahead of time.
         if (isset($node->path)) {
-          path_set_alias('node/'. $node->nid, $node->path);
+          path_set_alias('node/'. $node->nid, $node->path, NULL, $language);
         }
         break;
 
@@ -186,7 +174,7 @@ function path_form_alter(&$form, $form_s
     $path = isset($form['#node']->path) ? $form['#node']->path : NULL;
     $form['path'] = array(
       '#type' => 'fieldset',
-      '#title' => t('URL path settings'),
+      '#title' => t('Alternative URL settings'),
       '#collapsible' => TRUE,
       '#collapsed' => empty($path),
       '#access' => user_access('create url aliases'),
@@ -198,7 +186,7 @@ function path_form_alter(&$form, $form_s
       '#maxlength' => 250,
       '#collapsible' => TRUE,
       '#collapsed' => TRUE,
-      '#description' => t('Optionally specify an alternative URL by which this node can be accessed. For example, type "about" when writing an about page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'),
+      '#description' => t('Optionally specify an alternative URL by which this post can be accessed. For example, type "about" when writing an about page. Use a relative path and don\'t add a trailing slash or the URL alias won\'t work.'),
     );
     if ($path) {
       $form['path']['pid'] = array(
