Drupal is a registered trademark of Dries Buytaert
Drupal 11.4.2 Update released for Drupal core (11.4.2)! Drupal 11.4.1 Update released for Drupal core (11.4.1)! Drupal 11.4.0 Update released for Drupal core (11.4.0)! Drupal 10.6.12 Update released for Drupal core (10.6.12)! Drupal 11.3.13 Update released for Drupal core (11.3.13)! Drupal 10.6.11 Update released for Drupal core (10.6.11)! Drupal 11.3.12 Update released for Drupal core (11.3.12)! Drupal 11.2.14 Update released for Drupal core (11.2.14)! Drupal 10.5.12 Update released for Drupal core (10.5.12)! Cms 2.1.3 Update released for Drupal core (2.1.3)! Drupal 10.5.11 Update released for Drupal core (10.5.11)! Drupal 11.3.11 Update released for Drupal core (11.3.11)! Drupal 11.2.13 Update released for Drupal core (11.2.13)! Drupal 10.6.10 Update released for Drupal core (10.6.10)! Cms 2.1.2 Update released for Drupal core (2.1.2)! Drupal 11.1.10 Update released for Drupal core (11.1.10)! Drupal 10.5.10 Update released for Drupal core (10.5.10)! Drupal 10.4.10 Update released for Drupal core (10.4.10)! Drupal 11.2.12 Update released for Drupal core (11.2.12)! Drupal 11.3.10 Update released for Drupal core (11.3.10)!

Description

Select translation implements a Views filter to select which translation of a node should be displayed in a list of nodes.

Several modes are available to select a translation:

  • Use the current interface language; if not available use the original node language.
  • Use the current interface language; if not available use the default site language; if not available use the original node language.
  • Specify a list of languages, and use the most appropriate language.

    Some special values are recognized in the languages list:
    • "current" will be replaced with the current interface language;
    • "default" will be replaced with the default site language;
    • "original" will be replaced with the original node language.

Select translation also provides an API following the same selection algorithm as the Views filter.

Drupal 6 Compatibility

Select translation works with Content translations (not Entity translations).

If you have i18n, you should set 'Content selection mode' to 'All content' in i18nsettings (admin/settings/i18n).

API

Given a node id, and a selection mode, the function returns the node id to display.

Example:

  <?php
  $my_nid = select_translation_of_node($nid); // Uses 'default' mode
  $my_nid = select_translation_of_node($nid, 'original'); // Uses 'original' mode
  $my_nid = select_translation_of_node($nid, array('en', 'fr', 'current')); // Returns the best match
  ?>

Similar project : Active translation performs a similar function but it is not a Views filter - it acts on all queries of the whole site.

Drupal 7

Select translation starts using an optimized query for the Views filter plugin.

Drupal 8

Select translation works on Entity translations.

Since in Drupal 8 any node always have at least one "translation" (the original one), the include_content_without_translation option has been removed.

Drupal 9+

2.x is a Drupal 9+ successor of 8.x-1.x-dev. It's stability is currently alpha, so use with care!

API

Given a node id, and a selection mode, the function returns the entity translation.

Example:

  <?php
  use Drupal\node\Entity\Node;

  /* @var \Drupal\node\Entity\Node $my_node */
  $my_node = select_translation_of_node($nid); // Uses 'default' mode
  $my_node = select_translation_of_node($nid, 'original'); // Uses 'original' mode
  $my_node = select_translation_of_node($nid, 'en,fr,current'); // Returns the best match
  ?>

Activity

Total releases
1
First release
Jul 2026
Latest release
6 hours ago
Release cadence
Stability
0% stable

Releases

Version Type Release date
2.0.0-alpha6 Pre-release Jul 13, 2026