StaticTranslation
class StaticTranslation implements TranslatorInterface (View source)
String translator with a static cache for translations.
This is a high performance way to provide a handful of string replacements.
Properties
| protected array | $translations | String translations. |
Methods
__construct(array $translations = [])
Constructs a translator from an array of translations.
string|false
getStringTranslation(string $langcode, string $string, string $context)
Retrieves English string to given language.
reset()
Resets translation cache.
array
getLanguage(string $langcode)
Retrieves translations for a given language.
Details
__construct(array $translations = [])
Constructs a translator from an array of translations.
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.