Catch the English name of a translated taxonomy term (token) I'm building up a multilingual website (Drupal 7) with Locale and Content translation modules enabled for nodes. The node category is managed thru a content_area field (taxonomy term thru Entity Reference module), which is translated with Entity Translation and Title modules in order to have a translated path in URL (using Pathauto module). Everything goes as expected, the content_area is translated in URL, in the breadcrumb and in the tags area.

As each node manages more images, shared among languages, we've built a file folders structure which comply with paths (not equal but similar) in order to keep a clean images structure, using File (Field) Paths module.
Problems arise: if the content_area field (taxonomy term) is untranslated (i.e. English), we have only one folder for images of all languages (as expected), but if we translate the content_area field we get a translated folder keeping images, as we do not want.

When setting up File (Field) Paths for images field in File path, we expected to find a token related to the untranslated/translated [node:field_content_area:name], with no luck. Even [node:source:field_content_area] cannot work and do not work, as we cannot know if the editor building up the node content will begin ('source') from English or from another language.

I hope I have been clear, it is my first post.
Thanks in advance
Decipher's blog suggested the answer: I initially created a custom module to define a custom token to use in FileField Paths, and then I installed Custom Tokens module, and created same token as before.

Both methods worked, and at the end I'll use second method (installing Custom Tokens module, without my custom module), as it will be easier to create other tokens when needed.

Method 1:

/**
 * Implements hook_token_info().
 * gw_content_area_en is the token used as [node:gw_content_area_en]
 */
function MODULENAME_token_info() {

    $info['tokens']['node']['gw_content_area_en'] = array(
      'name' =&gt; t('Gw Content Area EN'),
      'description' =&gt; t('English version of field_gw_content_area'),
    );

    // Return associative array of tokens &amp; token types
    return $info;

}

/**
 * Implements hook_tokens().
 */
function MODULENAME_tokens($type, $tokens, array $data = array(), array $options = array()) {
  $replacements = array();

  // Check if token type is node
  if($type == 'node'){
    foreach ($tokens as $name =&gt; $original) {
      switch ($name) {
        // Check token is gw_content_area_en
        case 'gw_content_area_en':
          $tid = $data['node']-&gt;field_gw_content_area[LANGUAGE_NONE][0]['target_id'];
          $term = taxonomy_term_load($tid);
          $replacements[$original] = $term-&gt;name_original;
          break;
      }
    }
  }
  return $replacements;
}


Method 2:


Install Custom Tokens module; 
Create a new token with following settings:


Token name: Gw Content Area EN
Token description: English version of field_gw_content_area
Token type: Nodes
Content:


$tid = $data['node']->field_gw_content_area[LANGUAGE_NONE][0]['target_id'];

$term = taxonomy_term_load($tid);

return $term->name_original;




New custom token used to set FileField Path.

Note: i18n_taxonomy module disabled.