You are here

public function views_plugin_localization::process_locale_strings in Views (for Drupal 7) 7.3

Same name and namespace in other branches
  1. 6.3 plugins/views_plugin_localization.inc \views_plugin_localization::process_locale_strings()

File

plugins/views_plugin_localization.inc, line 152
Definition of views_plugin_localization.

Class

views_plugin_localization
The base plugin to handle localization of Views strings.

Code

public function process_locale_strings($op) {
  $this->view
    ->init_display();
  foreach ($this->view->display as $display_id => $display) {
    $translatable = array();

    // Special handling for display title.
    if (isset($display->display_title)) {
      $translatable[] = array(
        'value' => $display->display_title,
        'keys' => array(
          'display_title',
        ),
      );
    }

    // Unpack handlers.
    if (is_object($this->view->display[$display_id]->handler)) {
      $this->view->display[$display_id]->handler
        ->unpack_translatables($translatable);
    }
    foreach ($translatable as $data) {
      $data['keys'] = array_merge(array(
        $this->view->name,
        $display_id,
      ), $data['keys']);
      switch ($op) {
        case 'save':
          $this
            ->save($data);
          break;
        case 'delete':
          $this
            ->delete($data);
          break;
        case 'export':
          $this
            ->export($data);
          break;
      }
    }
  }
}