function views_plugin_localization::translate
3.x views_plugin_localization.inc | 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
$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 49 - Contains the base class for views localization plugins.
Class
- views_plugin_localization
- The base plugin to handle localization of Views strings.
Code
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'];
}