1.20.x locale.module locale_preprocess_node(&$variables)

Implements MODULE_preprocess_HOOK().

File

modules/locale/locale.module, line 1034
Add language handling functionality and enables the translation of the user interface to languages other than English.

Code

function locale_preprocess_node(&$variables) {
  if ($variables['langcode'] != LANGUAGE_NONE) {
    global $language;

    $node_language = language_load($variables['langcode']);
    if ($node_language->langcode != $language->langcode) {
      // If the node language was different from the page language, we should
      // add markup to identify the language. Otherwise the page language is
      // inherited.
      $variables['attributes']['lang'] = $variables['langcode'];
      if ($node_language->direction != $language->direction) {
        // If text direction is different form the page's text direction, add
        // direction information as well.
        $dir = array('ltr', 'rtl');
        $variables['attributes']['dir'] = $dir[$node_language->direction];
      }
    }
  }
}