public function views_plugin_localization::translate in Views (for Drupal 7) 7.3
Same name and namespace in other branches
- 6.3 plugins/views_plugin_localization.inc \views_plugin_localization::translate()
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.
1 method overrides views_plugin_localization::translate()
- views_plugin_localization_none::translate in plugins/
views_plugin_localization_none.inc - Translate a string; simply return the string.
File
- plugins/
views_plugin_localization.inc, line 56 - 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'];
}