TranslatorAdapterRepository
class TranslatorAdapterRepository implements TranslatorAdapterRepositoryInterface (View source)
Basic implementation of the TranslatorAdapterRepositoryInterface.
Stores the translator adapters in a local array.
Constants
KEY_SEPARATOR |
|
Properties
protected Application | $app | ||
protected array | $adapters |
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.
Generates a store key for the given handle and locale. The translator for the combination of these two is stored in the local array with the key returned by this method.
Details
__construct(TranslatorAdapterFactoryInterface $translatorAdapterFactory)
No description
registerTranslatorAdapter(string $handle, string $locale, TranslatorAdapterInterface $translatorAdater)
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.
protected string
getKey($handle, $locale)
Generates a store key for the given handle and locale. The translator for the combination of these two is stored in the local array with the key returned by this method.