1 views_plugin_localization.inc public views_plugin_localization::translate($source)

Translate a string / text with format.

The $source parameter is an array with the following elements:

  • value, source string
  • format, input format in case the text has some format to be applied
  • keys. An array of keys to identify the string. Generally constructed from view name, display_id, and a property, e.g., 'header'.

Parameters

string $source: Full data for the string to be translated.

Return value

string: Translated string / text.

File

core/modules/views/plugins/views_plugin_localization.inc, line 50
Definition of views_plugin_localization.

Class

views_plugin_localization
The base plugin to handle localization of Views strings.

Code

public function translate($source) {
  // Allow other modules to make changes to the string before and after
  // translation.
  $source['pre_process'] = $this->invoke_translation_process($source, 'pre');
  $source['translation'] = $this->translate_string($source['value'], $source['keys'], $source['format']);
  $source['post_process'] = $this->invoke_translation_process($source, 'post');
  return $source['translation'];
}