TranslatorAdapterRepositoryInterface
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
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.
Checks whether a translator has been defined for the given handle and 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.
Removes the translator for the given handle and locale.
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.
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.