Expose a way to generate aliases for _All_ languages.

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

This version of the patch allows the user to select from three different
options:

 - Default language handling (each alias will be enabled for the language of
   its node),

 - aliases for nodes without language-specific patterns will be enabled for
   all languages,

 - or aliases for all nodes (including those with language-specific patterns)
   will be enabled for all languages. 

Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Jack Aponte (jackaponte) <jack@palantetech.com>

Index: pathauto/pathauto.admin.inc
===================================================================
--- pathauto.orig/pathauto.admin.inc
+++ pathauto/pathauto.admin.inc
@@ -144,6 +144,21 @@
     '#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')) {
+    $lang_alias_options = array(
+      'default_handling' => t('Default language handling. Each alias will be enabled for the language of its node.'),
+      'no_lang_pattern_all_langs' => t('Aliases for nodes <em>without language-specific patterns</em> will be enabled for <strong>all languages</strong>.'),
+      'all_aliases_all_langs' => t('Aliases for <em>all nodes</em>, including those with language-specific patterns, will be enabled for <strong>all languages</strong>.'));
+
+    $form['general']['pathauto_node_enable_alias_for_all_languages'] = array(
+      '#type' => 'radios',
+      '#title' => t('Language handling for aliases of localized nodes'),
+      '#default_value' => variable_get('pathauto_node_enable_alias_for_all_languages', 'default_handling'),
+      '#options' => $lang_alias_options,
+      '#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.inc
===================================================================
--- pathauto.orig/pathauto.inc
+++ pathauto/pathauto.inc
@@ -274,6 +274,24 @@
     }
   }
 
+  if ($module == 'node') {
+      $alias_for_all_languages = variable_get('pathauto_node_enable_alias_for_all_languages', 'default_handling');
+
+      // FIXME: the two conditions below can be merged. In the final patch.
+
+      if ($alias_for_all_languages == 'no_lang_pattern_all_langs') {
+	// Check if there isn't a language specific pattern.
+	if ('' == variable_get('pathauto_node_' . $type . '_' . $language . '_pattern', '')) {
+	  $language = '';
+	}
+      }
+      // FIXME: is all this language mangling 'node' specific or if can be
+      // useful for other modules as well?
+      else if ($alias_for_all_languages == 'all_aliases_all_langs') {
+	$language = '';
+      }
+  }
+
   // Special handling when updating an item which is already aliased.
   $pid = NULL;
   $old_alias = NULL;
