Select translation

Anselm Heaton - June 17, 2008 - 11:28

Description

Select translation implements a Views filter which allows you to select, for a group of nodes representing a same translation, which of the translation should be displayed.

The options are :

  • Use current language ; if not available use original language
  • Use current language ; if not available use default language ; if not available use original language
  • Provide a list of languages, so that the most appropriate language is selected. The list can contain the special values 'current', 'default' and 'original' for, respectively, the current language, the default language and the node's original language.

API

Select translation also provides an API to let users select the correct translation of a given node. This can be useful in code snippets, or when writing your own module. Given a node id, the function returns the node id to display, following the same algorithm as the view filter. Usage :

  <?php
    $my_nid
= select_translation_of_node($nid); // Uses 'default' mode
   
$my_nid = select_translation_of_node($nid, 'original'); // Uses 'original' algorithm
   
$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.

Compatibility

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

Releases

Development snapshotsDateSizeLinksStatus
6.x-0.x-dev2009-Feb-178.04 KBDevelopment snapshotDevelopment snapshots are automatically regenerated and their contents can frequently change, so they are not recommended for production use.


 
 

Drupal is a registered trademark of Dries Buytaert.