0
  • Drupal 7.34 core
  • Using custom theme from Themebrain TB Sirate
  • Multilingual setup works properly
  • Content type has both English and Russian values

English Language mode: When open/viewing a node, page-title display content type that is "Article" (English)

enter image description here

Russian Language mode: When open/viewing a node, page-title display content type that is "Article" (still English, must be Russian)

enter image description here

Question how to display Russian value of content type.

Here code from preprocess_funcion.inc of the custom theme

/**
 * @file
 * Override of theme_preprocess_...
 */

function tb_sirate_preprocess_html(&$vars) {
  $current_skin = theme_get_setting('skin');
  if (isset($_COOKIE['nucleus_skin'])) {
    $current_skin = $_COOKIE['nucleus_skin'];
  }
  $vars['classes_array'][] = !empty($current_skin) ? (" " . $current_skin . "-skin") : "";  
}

/**
 * Override or insert variables into the page template.
 *
 * @param array $vars
 *   An array of variables to pass to the theme template.
 */
function tb_sirate_preprocess_page(&$vars) {
  if (isset($vars['node'])) {
    if ($vars['node']->type != 'page') {
      $result = db_select('node_type', NULL, array('fetch' => PDO::FETCH_ASSOC))
        ->fields('node_type', array('name'))
        ->condition('type', $vars['node']->type)
        ->execute();
      foreach ($result as $item) {
        $vars['title'] = $item['name'];
      }
    }
  }
}

/**
 * Override or insert variables into the node template.
 *
 * @param array $vars
 *   An array of variables to pass to the theme template.
 */
function tb_sirate_preprocess_node(&$vars) {
  $vars['page'] = ($vars['type'] == 'page') ? TRUE : FALSE;
}

It seems to me that problem is here

    function tb_sirate_preprocess_page(&$vars) {
  if (isset($vars['node'])) {
    if ($vars['node']->type != 'page') {
      $result = db_select('node_type', NULL, array('fetch' => PDO::FETCH_ASSOC))
        ->fields('node_type', array('name'))
        ->condition('type', $vars['node']->type)
        ->execute();
      foreach ($result as $item) {
        $vars['title'] = $item['name'];
      }
    }
  }
}

What can I do to pull Russian value of the content type from DB?

Thanks in advance for any help!

0

You can confirm this by looking under the "Overview" tab of the translation interface:

Overview 1

If the percentage in the "Node types" for your second language is ("Norwegian Bokmål" in the image above) is 0%, the translated strings for the Node types has not been imported into the translation interface. This means that even after you enable that language, the fallback English strings will be used.

However, it should now be possible to add these translation by hand. Navigate to the translate tab of the translation interface, and limit search to Node types.

Translate

The strikethrough over the string with the two letters in the Languages column means that the translation is missing. Click "edit" to add the missing translation.

This exact procedure fixed it for me as can be seen from the "Overview" tab below. The percentage for "Node types" for "Norwegian Bokmål" in now 100%.

Overwiew 2

  • I can confirm that node type is translated properly. It reads Russian part appropriately. The issue still persists :-( – SaidAkh Dec 20 '14 at 17:31
0

Here is the solution. I am glad to have it resolved

http://www.themebrain.com/question/nodes-page-title-does-not-pick-translated-value

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.