You are here

function _heartbeat_messages_overview_language in Heartbeat 6.4

Same name and namespace in other branches
  1. 6.3 heartbeat.admin.inc \_heartbeat_messages_overview_language()

Helper function to build list for multilingual messages

1 call to _heartbeat_messages_overview_language()
heartbeat_messages_overview in ./heartbeat.admin.inc
Overview list of heartbeat messages This page must be viewed to make the messages appear in the database after a module is installed as well as make them translatable

File

./heartbeat.admin.inc, line 872
Admnistration tasks for heartbeat.

Code

function _heartbeat_messages_overview_language($languages, &$message) {

  // Pretend we are showing the strings to translate
  // Mis-usage of the t-function, but how could i fix this?
  $fake_message = t($message->message);
  $fake_message_concat = t($message->message_concat);

  // Show the admin user that there are things that need translation
  $report = array();
  foreach ($languages as $lang => $human_language) {
    if ($lang != 'en') {

      // Look into the messages
      if (locale($message->message, $lang) == locale($message->message, 'en')) {
        $label = t('@human_language translation', array(
          '@human_language' => strip_tags($human_language),
        ));
        $options = array(
          'query' => 'op=Search&string=' . str_replace(" ", "+", $message->message),
        );
        $report[] = l($label, 'admin/build/translate/search', $options);
      }

      // Look into the message_concat groupings
      if (t($message->message_concat, array(), $lang) == t($message->message_concat, array(), 'en')) {
        $label = t('@human_language translation', array(
          '@human_language' => strip_tags($human_language),
        ));
        $options = array(
          'query' => 'op=Search&string=' . str_replace(" ", "+", $message->message_concat),
        );
        $report[] = l($label, 'admin/build/translate/search', $options);
      }
    }
  }

  // Add a report of todo translations to the list
  if ($report != array()) {
    $message->description .= '<div><small>' . implode(', ', $report) . '</small></div>';
  }
}