function views_plugin_localization_core::export_render

Same name in other branches
  1. 7.x-3.x plugins/views_plugin_localization_core.inc \views_plugin_localization_core::export_render()

Render any collected exported strings to code.

Parameters

$indent: An optional indentation for prettifying nested code.

Overrides views_plugin_localization::export_render

File

plugins/views_plugin_localization_core.inc, line 97

Class

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

Code

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;
}