function openlayers_i18n_string in Openlayers 7.3
Translate a string using i18n_string, if available.
Parameters
string $name: Textgroup and context glued with ':'.
string $default: String in default language. Default language may or may not be English.
array $options: An associative array of additional options, with the following keys:
- langcode: the language code to translate to a language other than what is used to display the page; defaults to the current language
- filter: filtering callback to apply to the translated string only
- format: input format to apply to the translated string only
- callback: callback to apply to the result (both to the translated or untranslated string)
- update: whether to update source table; defaults to FALSE
- translate: whether to return a translation; defaults to TRUE.
Return value
string The translated string if i18n_string is available, the original otherwise.
See also
1 call to openlayers_i18n_string()
- LayerSwitcher::preBuild in src/
Plugin/ Control/ LayerSwitcher/ LayerSwitcher.php - Invoked before an objects render array is built.
File
- ./
openlayers.module, line 120 - Openlayers module.
Code
function openlayers_i18n_string($name, $default, $options = array()) {
if (module_exists('i18n_string')) {
$result = i18n_string($name, $default, $options);
}
else {
$result = $default;
$options += array(
'format' => NULL,
'sanitize' => FALSE,
);
if ($options['sanitize']) {
$result = check_markup($result, $options['format']);
}
}
return $result;
}