class TranslatorAdapterFactory implements TranslatorAdapterFactoryInterface (View source)

The core translator adapter factory is a wrapper factory that abstracts the translator creation based on the passed locale. By default, a translator instance will be created through the {@link ZendTranslatorAdapterFactory}.

If the passed locale is the system's base locale and if translations are NOT enabled for the base locale, a translator instance will be created through the {@link PlainTranslatorAdapterFactory}.

Properties

protected Repository $config
protected TranslatorAdapterFactory $plainFactory
protected TranslatorAdapterFactory $zendFactory

Methods

__construct(Repository $config, TranslatorAdapterFactory $plainFactory, TranslatorAdapterFactory $zendFactory)

No description

createTranslatorAdapter(string $locale)

Creates a translator adapter for the given locale.

shouldTranslateBaseLocale()

No description

Details

__construct(Repository $config, TranslatorAdapterFactory $plainFactory, TranslatorAdapterFactory $zendFactory)

Parameters

Repository $config
TranslatorAdapterFactory $plainFactory
TranslatorAdapterFactory $zendFactory

TranslatorAdapterInterface createTranslatorAdapter(string $locale)

Creates a translator adapter for the given locale.

Parameters

string $locale

Return Value

TranslatorAdapterInterface

private shouldTranslateBaseLocale()