StringTranslationTrait.php in Simple hierarchical select 2.0.x
File
src/StringTranslationTrait.php
View source
<?php
namespace Drupal\shs;
use Drupal\Core\StringTranslation\StringTranslationTrait as StringTranslationTraitCore;
trait StringTranslationTrait {
protected $translationContext = 'shs';
use StringTranslationTraitCore {
t as tCore;
formatPlural as formatPluralCore;
}
protected function t($string, array $args = [], array $options = []) {
if (empty($options['context'])) {
$options['context'] = $this->translationContext;
}
return $this
->tCore($string, $args, $options);
}
protected function formatPlural($count, $singular, $plural, array $args = [], array $options = []) {
if (empty($options['context'])) {
$options['context'] = $this->translationContext;
}
return $this
->formatPluralCore($count, $singular, $plural, $args, $options);
}
}