LocaleTranslation
class LocaleTranslation implements TranslatorInterface, DestructableInterface (View source)
String translator using the locale module.
Full featured translation system using locale's string storage and database caching.
Traits
Provides dependency injection friendly methods for serialization.
Properties
| protected array | $_serviceIds | An array of service IDs keyed by property name used for serialization. |
from DependencySerializationTrait |
| protected array | $_entityStorages | An array of entity type IDs keyed by the property name of their storages. |
from DependencySerializationTrait |
| protected StringStorageInterface | $storage | Storage for strings. |
|
| protected ConfigFactoryInterface | $configFactory | The configuration factory. |
|
| protected array | $translations | Cached translations. |
|
| protected CacheBackendInterface | $cache | The cache backend that should be used. |
|
| protected LockBackendInterface | $lock | The lock backend that should be used. |
|
| protected bool | $translateEnglish | The translate english configuration value. |
|
| protected LanguageManagerInterface | $languageManager | The language manager. |
|
| protected RequestStack | $requestStack | The request stack. |
Methods
Constructs a translator using a string storage.
Retrieves English string to given language.
Gets translate english configuration value.
Resets translation cache.
Performs destruct operations.
Details
__sleep()
{@inheritdoc}
__wakeup()
{@inheritdoc}
__construct(StringStorageInterface $storage, CacheBackendInterface $cache, LockBackendInterface $lock, ConfigFactoryInterface $config_factory, LanguageManagerInterface $language_manager, RequestStack $request_stack)
Constructs a translator using a string storage.
string|false
getStringTranslation(string $langcode, string $string, string $context)
Retrieves English string to given language.
protected bool
canTranslateEnglish()
Gets translate english configuration value.
reset()
Resets translation cache.
Since most translation systems implement some form of caching, this provides a way to delete that cache.
destruct()
Performs destruct operations.