Expose a way to generate aliases for _All_ languages.

You can read the details of the issue here:
  http://drupal.org/node/321848

NOTE: if the user choose this "Language Neutral" behaviour, but a
language-specific pattern is set for a given node type, the latter will be
used. This addresses some comments from other users.

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>

Index: pathauto/pathauto.admin.inc
===================================================================
--- pathauto.orig/pathauto.admin.inc
+++ pathauto/pathauto.admin.inc
@@ -144,6 +144,15 @@
     '#description' => t('Words to strip out of the URL alias, separated by commas. Do not place punctuation in here and do not use WYSIWYG editors on this field.'),
   );
 
+  if (module_exists('locale')) {
+    $form['general']['pathauto_node_enable_alias_for_all_languages'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Enable Node aliases for all languages'),
+      '#default_value' => variable_get('pathauto_node_enable_alias_for_all_languages', FALSE),
+      '#description' => t('Enable Language Neutral behaviour in alias creation for localized nodes. By enabling this setting, aliases for nodes <em>without language specific patterns</em> will be enabled for <strong>all languages</strong>.'),
+    );
+  }
+
   $form['punctuation'] = array(
     '#type' => 'fieldset',
     '#weight' => $group_weight,
Index: pathauto/pathauto.module
===================================================================
--- pathauto.orig/pathauto.module
+++ pathauto/pathauto.module
@@ -242,7 +242,17 @@
           if (!isset($node->pathauto_perform_alias) || $node->pathauto_perform_alias) {
             $placeholders = pathauto_get_placeholders('node', $node);
             $src = "node/$node->nid";
-            $alias = pathauto_create_alias('node', $op, $placeholders, $src, $node->nid, $node->type, $node->language);
+
+            $_lang = $node->language;
+            // If there is not a language specific pattern then see if we have to
+            // create the alias for all languages
+            if ('' == variable_get('pathauto_'. 'node' .'_'. $node->type .'_'. $node->language .'_pattern', '')) {
+              if (variable_get('pathauto_node_enable_alias_for_all_languages', FALSE)) {
+                $_lang = '';
+              }
+            }
+
+            $alias = pathauto_create_alias('node', $op, $placeholders, $src, $node->nid, $node->type, $_lang);
           }
         }
         break;
Index: pathauto/pathauto_node.inc
===================================================================
--- pathauto.orig/pathauto_node.inc
+++ pathauto/pathauto_node.inc
@@ -112,7 +112,17 @@
       }
       $placeholders = pathauto_get_placeholders('node', $node);
       $src = "node/$node->nid";
-      if ($alias = pathauto_create_alias('node', 'bulkupdate', $placeholders, $src, $node->nid, $node->type, $node->language)) {
+
+      $_lang = $node->language;
+      // If there is not a language specific pattern then see if we have to
+      // create the alias for all languages
+      if ('' == variable_get('pathauto_'. 'node' .'_'. $node->type .'_'. $node->language .'_pattern', '')) {
+        if (variable_get('pathauto_node_enable_alias_for_all_languages', FALSE)) {
+          $_lang = '';
+        }
+      }
+
+      if ($alias = pathauto_create_alias('node', 'bulkupdate', $placeholders, $src, $node->nid, $node->type, $_lang)) {
         $count++;
       }
     }
