interface TranslatorInterface (View source)

Interface for objects capable of string translation.

Methods

string|false
getStringTranslation(string $langcode, string $string, string $context)

Retrieves English string to given language.

reset()

Resets translation cache.

Details

string|false getStringTranslation(string $langcode, string $string, string $context)

Retrieves English string to given language.

Parameters

string $langcode

Language code to translate to.

string $string

The source string.

string $context

The string context.

Return Value

string|false

Translated string if there is a translation, FALSE if not.

reset()

Resets translation cache.

Since most translation systems implement some form of caching, this provides a way to delete that cache.