When I have i18nviews installed - and get taxonomy: term (using views) - the [name] is translated which is fine for display - but I also need to create a link to this taxonomy (using taxonomy term, not tid) - and that link needs the original (untranslated) name to work :(

I'd suggest that when i18nviews translated [name] (and others) - it also adds an [name_orig] or similar.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Cyberwolf’s picture

The actual problem is that the field handler changes the values retrieved by the Views query. See i18nviews_handler_field_taxonomy_term_name::pre_render():

  function pre_render(&$values) {
    foreach ($values as $key => $value) {
      if (isset($value->{$this->field_alias})) {
        $term = new stdClass();
        $term->tid = $this->get_value($value, 'tid');
        $term->vid = $this->get_value($value, 'vid');
        $term->name = $this->get_value($value);
        $values[$key]->{$this->field_alias} = i18n_taxonomy_term_name($term);
      }
    }

It shouldn't change the original value, instead it should render the translated value in the render() method. Attached is a patch that fixes this for the term name.

Probably other stuff needs fixing as well, like the term description.

dawehner’s picture

This seems to be a duplicate of #1283024: Translation overrides field values