Class TranslatorFactory
Factory to create translators
Namespace: Cake\I18n
Property Summary
-
$class protected
string
The class to use for new instances.
Method Summary
-
newInstance() public
Returns a new Translator.
Method Detail
newInstance() ¶ public
newInstance(string $locale, array $messages, FormatterInterface $formatter, TranslatorInterface $fallback = null): Cake\I18n\Translator
Returns a new Translator.
Parameters
-
string
$locale The locale code for the translator.
-
array
$messages The localized messages for the translator.
-
FormatterInterface
$formatter The formatter to use for interpolating token values.
-
TranslatorInterface
$fallback optional A fallback translator to use, if any.
Returns
Cake\I18n\Translator
Throws
Cake\Core\Exception\Exception
If fallback class does not match Cake\I18n\Translator