class IdentityTranslator in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/translation/IdentityTranslator.php \Symfony\Component\Translation\IdentityTranslator
IdentityTranslator does not translate anything.
@author Fabien Potencier <fabien@symfony.com>
Hierarchy
- class \Symfony\Component\Translation\IdentityTranslator implements TranslatorInterface
Expanded class hierarchy of IdentityTranslator
6 files declare their use of IdentityTranslator
- IdentityTranslatorTest.php in vendor/
symfony/ translation/ Tests/ IdentityTranslatorTest.php - LegacyValidator2Dot5ApiTest.php in vendor/
symfony/ validator/ Tests/ Validator/ LegacyValidator2Dot5ApiTest.php - LegacyValidatorLegacyApiTest.php in vendor/
symfony/ validator/ Tests/ Validator/ LegacyValidatorLegacyApiTest.php - LegacyValidatorTest.php in vendor/
symfony/ validator/ Tests/ LegacyValidatorTest.php - RecursiveValidator2Dot5ApiTest.php in vendor/
symfony/ validator/ Tests/ Validator/ RecursiveValidator2Dot5ApiTest.php
File
- vendor/
symfony/ translation/ IdentityTranslator.php, line 19
Namespace
Symfony\Component\TranslationView source
class IdentityTranslator implements TranslatorInterface {
private $selector;
private $locale;
/**
* Constructor.
*
* @param MessageSelector|null $selector The message selector for pluralization
*/
public function __construct(MessageSelector $selector = null) {
$this->selector = $selector ?: new MessageSelector();
}
/**
* {@inheritdoc}
*/
public function setLocale($locale) {
$this->locale = $locale;
}
/**
* {@inheritdoc}
*/
public function getLocale() {
return $this->locale ?: \Locale::getDefault();
}
/**
* {@inheritdoc}
*/
public function trans($id, array $parameters = array(), $domain = null, $locale = null) {
return strtr((string) $id, $parameters);
}
/**
* {@inheritdoc}
*/
public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null) {
return strtr($this->selector
->choose((string) $id, (int) $number, $locale ?: $this
->getLocale()), $parameters);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
IdentityTranslator:: |
private | property | ||
IdentityTranslator:: |
private | property | ||
IdentityTranslator:: |
public | function |
Returns the current locale. Overrides TranslatorInterface:: |
|
IdentityTranslator:: |
public | function |
Sets the current locale. Overrides TranslatorInterface:: |
|
IdentityTranslator:: |
public | function |
Translates the given message. Overrides TranslatorInterface:: |
|
IdentityTranslator:: |
public | function |
Translates the given choice message by choosing a translation according to a number. Overrides TranslatorInterface:: |
|
IdentityTranslator:: |
public | function | Constructor. |