public function PassthroughTranslator::translate in Backup and Migrate 5.0.x
Parameters
string $string: The string to be translated.
$replacements: Any untranslatable variables to be replaced into the string.
$context: Extra context to help translators distinguish ambiguous strings.
Return value
mixed
Overrides TranslatorInterface::translate
File
- src/
Core/ Translation/ PassthroughTranslator.php, line 22
Class
- PassthroughTranslator
- Passes through the us-english strings with the replacement tokens.
Namespace
Drupal\backup_migrate\Core\TranslationCode
public function translate($string, $replacements = [], $context = []) {
// Provide Drupal-like escaping of replacement values.
foreach ($replacements as $key => $value) {
switch (substr($key, 0, 1)) {
case '@':
case '%':
$replacements[$key] = strip_tags($value);
break;
}
}
return strtr($string, $replacements);
}