Node's page title does not pick up translated value

+1
0
-1

Using latest version of TB Sirate on multilingual website. A great theme and the great work, thanks Themebrain.

Notice that when look at a node, a Page Title that is a Content Type displays always English value, no matter what is translated value. Seems like a bug in Themebrain's overridden preprocess_function.inc

This part does not work correctly on multilingual site


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 we do to fix it?

+1
+1
-1

Hi Said,

Thanks for spotting the issue. To fix the issue, we should use translation function provided by Drupal core. Replace below code:
$vars['title'] = $item['name'];
by following code:
$vars['title'] = t($item['name']);

Kind regards,
Will