You are here

private function user_activity::save_locale in Heartbeat 6.2

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

Parameters

array $raw_args:

1 call to user_activity::save_locale()
user_activity::save in ./heartbeat.module
Public function to save activity to database

File

./heartbeat.module, line 113
To fully understand this, you have to be familiar with the rules module. Lots of documentation can be found on http://drupal.org/node/298480 for an introduction and tutorial, but http://drupal.org/node/298486 is a lot of handy info for developers.

Class

user_activity
Class to handle user activity data

Code

private function save_locale($raw_args = array()) {
  $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] = t($locale[$key], array(), $language);
      }
    }
    $this
      ->log_message($args, $language);
  }
}