You are here

private function HeartbeatActivity::save_locale in Heartbeat 6.3

Same name and namespace in other branches
  1. 6.4 includes/heartbeatactivity.inc \HeartbeatActivity::save_locale()

Save activity log with multilingual content and multilingual parts to pre-translate

Parameters

array $raw_args:

1 call to HeartbeatActivity::save_locale()
HeartbeatActivity::save in includes/heartbeatactivity.inc
Public function to save activity to database

File

includes/heartbeatactivity.inc, line 138

Class

HeartbeatActivity
Class to handle user activity data

Code

private function save_locale($raw_args = array()) {
  $logged = FALSE;
  $args = $this
    ->rebuild_arguments($raw_args, true);
  $locale = $args['locale'];
  unset($args['locale']);

  // Save activity by logging a row for each active language
  // Translations only when locale exists
  $languages = locale_language_list();
  foreach ($languages as $language => $human_language) {

    // preprocess multilingual message "parts"
    // for all flagged token replacements
    foreach ($this->m_variables_array as $key => $value) {
      if (isset($locale[$key])) {
        $amp_token = str_replace("#", "!", $key);
        $args[$amp_token] = locale($locale[$key], $language);
      }
    }
    $logged = $this
      ->log_message($args, $language);
  }
  return $logged;
}