How to use the language neutral url alias pattern in pathauto? I want to use the following patterns in pathauto:


myCT All languages: pattern1 
myCT neutral language: pattern2  
myCT EN language: pattern2


So that all neutral (UND) and EN nodes of myCT have pattern2 and all other languages have pattern1. I'm using the ALL languages pattern for all other, as I have many other languages that should have the same pattern and I do not want to repeat it.

I'm using entity translation module for myCT.

When I create a node and save it having the default language (UND) and automatic path alias, pattern1 is always generated. I have to re-edit the node to have it get the correct pattern (for UND/neutral language), pattern2.

First of all, the pathauto_pattern_load_by_entity function (pathauto.module file) is called before the node creation, so the language of the node is always UND during creation of a node.

Second, trying to debug the pathauto module I can see the following:

function pathauto_pattern_load_by_entity($entity, $bundle = '', $language = LANGUAGE_NONE) {
  $patterns = &amp;drupal_static(__FUNCTION__, array());

  $pattern_id = "$entity:$bundle:$language";
  if (!isset($patterns[$pattern_id])) {
    $variables = array();
    if ($language != LANGUAGE_NONE) {
      $variables[] = "pathauto_{$entity}_{$bundle}_{$language}_pattern";
    }
    if ($bundle) {
      $variables[] = "pathauto_{$entity}_{$bundle}_pattern";
    }
    $variables[] = "pathauto_{$entity}_pattern";

    foreach ($variables as $variable) {
      if ($pattern = trim(variable_get($variable, ''))) {
        break;
      }
    }

    $patterns[$pattern_id] = $pattern;
  }

  return $patterns[$pattern_id];
}


So in the following lines it seems that it never takes into account the neutral language path.

if ($language != LANGUAGE_NONE) {
   $variables[] = "pathauto_{$entity}_{$bundle}_{$language}_pattern";
}


Shouldn't that if statement be removed? How is it possible to use the neutral language path otherwise?
You can use the Pathauto i18n module:


  This module provides functionality to create aliases for each
  language. Also this module will be helpful, if you use field
  translation and you want show node on all language with paths,
  different from node/nid.