CustomStrings
class CustomStrings extends StaticTranslation (View source)
String translator using overrides from variables.
This is a high performance way to provide a handful of string replacements. See settings.php for examples.
Traits
Provides dependency injection friendly methods for serialization.
Properties
| protected array | $translations | String translations |
from StaticTranslation |
| 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 Settings | $settings | The settings read only object. |
Methods
Retrieves English string to given language.
Retrieves translations for a given language.
Details
__construct(Settings $settings)
Constructs a CustomStrings object.
string|false
getStringTranslation(string $langcode, string $string, string $context)
Retrieves English string to given language.
reset()
Resets translation cache.
Since most translation systems implement some form of caching, this provides a way to delete that cache.
protected array
getLanguage(string $langcode)
Retrieves translations for a given language.
__sleep()
{@inheritdoc}
__wakeup()
{@inheritdoc}