I have a localized vocabulary called 'topics', English and German. A glossary-like view I am building should

a) show all terms ...
b) grouped by starting letter ...
c) in the user's current language

a) and c) works fine. I have also been able to get b) working, with one remaining sorting problem:

In German, the glossary starting letter starts with A and ends with Z. As soon as I switch to English, all terms are properly shown in English, too. However, the glossary remains sorted by the German starting letter . Since my first German term is "Abonnements", which means "Subscription" in English, the glossary starts with S.

I have attached two screenshots, English and German, to illustrate the issue. I'd be happy if someone could point me in the right direction. I have played with that view for hours but I am unable to tell that view to sort by rendered term. Also, the export of the view is below - many thanks!

$view = new view();
$view->name = 'themenindex';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'taxonomy_term_data';
$view->human_name = 'themenindex';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'All Topics at a Glance';
$handler->display->display_options['use_more_always'] = FALSE;
$handler->display->display_options['use_more_text'] = 'mehr';
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['exposed_form']['options']['submit_button'] = 'Anwenden';
$handler->display->display_options['exposed_form']['options']['reset_button_label'] = 'Zurücksetzen';
$handler->display->display_options['exposed_form']['options']['exposed_sorts_label'] = 'Sortieren nach';
$handler->display->display_options['exposed_form']['options']['sort_asc_label'] = 'Aufsteigend';
$handler->display->display_options['exposed_form']['options']['sort_desc_label'] = 'Absteigend';
$handler->display->display_options['pager']['type'] = 'none';
$handler->display->display_options['style_plugin'] = 'grid';
$handler->display->display_options['style_options']['grouping'] = array(
  0 => array(
    'field' => 'rendered_entity_1',
    'rendered' => 1,
    'rendered_strip' => 0,
  ),
);
$handler->display->display_options['style_options']['alignment'] = 'vertical';
$handler->display->display_options['row_plugin'] = 'fields';
$handler->display->display_options['row_options']['inline'] = array(
  'rendered_entity' => 'rendered_entity',
);
/* Feld: Starting Letter */
$handler->display->display_options['fields']['rendered_entity_1']['id'] = 'rendered_entity_1';
$handler->display->display_options['fields']['rendered_entity_1']['table'] = 'views_entity_taxonomy_term';
$handler->display->display_options['fields']['rendered_entity_1']['field'] = 'rendered_entity';
$handler->display->display_options['fields']['rendered_entity_1']['ui_name'] = 'Starting Letter';
$handler->display->display_options['fields']['rendered_entity_1']['label'] = '';
$handler->display->display_options['fields']['rendered_entity_1']['exclude'] = TRUE;
$handler->display->display_options['fields']['rendered_entity_1']['alter']['max_length'] = '1';
$handler->display->display_options['fields']['rendered_entity_1']['alter']['word_boundary'] = FALSE;
$handler->display->display_options['fields']['rendered_entity_1']['alter']['ellipsis'] = FALSE;
$handler->display->display_options['fields']['rendered_entity_1']['alter']['trim'] = TRUE;
$handler->display->display_options['fields']['rendered_entity_1']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['rendered_entity_1']['link_to_entity'] = 0;
$handler->display->display_options['fields']['rendered_entity_1']['view_mode'] = 'full';
/* Feld: Taxonomie-Begriff: Rendered Taxonomie-Begriff */
$handler->display->display_options['fields']['rendered_entity']['id'] = 'rendered_entity';
$handler->display->display_options['fields']['rendered_entity']['table'] = 'views_entity_taxonomy_term';
$handler->display->display_options['fields']['rendered_entity']['field'] = 'rendered_entity';
$handler->display->display_options['fields']['rendered_entity']['label'] = '';
$handler->display->display_options['fields']['rendered_entity']['element_label_colon'] = FALSE;
$handler->display->display_options['fields']['rendered_entity']['link_to_entity'] = 1;
$handler->display->display_options['fields']['rendered_entity']['view_mode'] = 'full';
/* Sort criterion: Taxonomie-Begriff: Name */
$handler->display->display_options['sorts']['name']['id'] = 'name';
$handler->display->display_options['sorts']['name']['table'] = 'taxonomy_term_data';
$handler->display->display_options['sorts']['name']['field'] = 'name';
/* Filter criterion: Taxonomie-Vokabular: Maschinenlesbarer Name */
$handler->display->display_options['filters']['machine_name']['id'] = 'machine_name';
$handler->display->display_options['filters']['machine_name']['table'] = 'taxonomy_vocabulary';
$handler->display->display_options['filters']['machine_name']['field'] = 'machine_name';
$handler->display->display_options['filters']['machine_name']['value'] = array(
  'topics' => 'topics',
);

/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['defaults']['hide_admin_links'] = FALSE;
$handler->display->display_options['path'] = 'themen';
$handler->display->display_options['menu']['title'] = 'nach Autoren';
$handler->display->display_options['menu']['weight'] = '0';
$handler->display->display_options['menu']['name'] = 'menu-drop-down';
$handler->display->display_options['menu']['context'] = 0;
$translatables['themenindex'] = array(
  t('Master'),
  t('All Topics at a Glance'),
  t('mehr'),
  t('Anwenden'),
  t('Zurücksetzen'),
  t('Sortieren nach'),
  t('Aufsteigend'),
  t('Absteigend'),
  t('Page'),
);
CommentFileSizeAuthor
e.png50.38 KBAnonymous (not verified)
g.png44.99 KBAnonymous (not verified)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

Title: Grouped taxonomy terms not sorted by current user's but source language » Add sort handler: rendered taxonomy term name
Version: 7.x-3.5 » 7.x-3.x-dev
Category: support » feature

I have realized this must be a missing feature. Please correct my if I am wrong. Taxonomy terms cannot be sorted by their translated name, as of now. Isn't this a very important use case?

Thanks,
Stephan

dawehner’s picture

Project: Views (for Drupal 7) » Internationalization Views
Component: taxonomy data » Code

The translation sorting can only be handled by i18nviews.

Anonymous’s picture

This is confusing. Being able to _filter_ by rendered tayxonomy term doesn't come from i18nviews but _ordering_ by it should?

dawehner’s picture

You can never filter by the rendered output though you have to implement the logic, where the actual value is stored, as part of the filter.
As you said that the term is translated via i18n, this logic have to be part of i18nviews