interface TranslatorAdapterRepositoryInterface (View source)

Translator adapter repository can store any number of translator adapters.

Used for storing multiple translator adapter instances and fetching them for different purposes.

Methods

registerTranslatorAdapter(string $handle, string $locale, TranslatorAdapterInterface $translatorAdapter)

Registers the translator for the given handle and locale to be the object provided as the third parameter. The passed adapter needs to implement the TranslatorAdapterInterface.

hasTranslatorAdapter(string $handle, string $locale)

Checks whether a translator has been defined for the given handle and locale.

mixed
getTranslatorAdapter(string $handle, string $locale)

Gets the translator for the given handle and locale. This will also initialize the translator object for the given handle if it has not been fetched previously through this method.

removeTranslatorAdapter(string $handle, string $locale)

Removes the translator for the given handle and locale.

removeTranslatorAdaptersWithHandle($handle)

Removes all the translators for the given handle, no matter what their locale is.

Details

registerTranslatorAdapter(string $handle, string $locale, TranslatorAdapterInterface $translatorAdapter)

Registers the translator for the given handle and locale to be the object provided as the third parameter. The passed adapter needs to implement the TranslatorAdapterInterface.

Parameters

string $handle
string $locale
TranslatorAdapterInterface $translatorAdapter

hasTranslatorAdapter(string $handle, string $locale)

Checks whether a translator has been defined for the given handle and locale.

Parameters

string $handle
string $locale

mixed getTranslatorAdapter(string $handle, string $locale)

Gets the translator for the given handle and locale. This will also initialize the translator object for the given handle if it has not been fetched previously through this method.

Parameters

string $handle
string $locale

Return Value

mixed

The translator object

removeTranslatorAdapter(string $handle, string $locale)

Removes the translator for the given handle and locale.

Parameters

string $handle
string $locale

removeTranslatorAdaptersWithHandle($handle)

Removes all the translators for the given handle, no matter what their locale is.

Parameters

$handle