You are here

public function views_plugin_localization_core::export_render in Views (for Drupal 7) 7.3

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

Render any collected exported strings to code.

Parameters

string $indent: An optional indentation for prettifying nested code.

Overrides views_plugin_localization::export_render

File

plugins/views_plugin_localization_core.inc, line 98
Definition of views_plugin_localization_core.

Class

views_plugin_localization_core
Localization plugin to pass translatable strings through t().

Code

public function export_render($indent = '  ') {
  $output = '';
  if (!empty($this->export_strings)) {
    $this->export_strings = array_unique($this->export_strings);
    $output = $indent . '$translatables[\'' . $this->view->name . '\'] = array(' . "\n";
    foreach ($this->export_strings as $string) {
      $output .= $indent . "  t('" . str_replace("'", "\\'", $string) . "'),\n";
    }
    $output .= $indent . ");\n";
  }
  return $output;
}