Class TranslatorFactory

Factory to create translators

Namespace: Cake\I18n

Properties summary

  • $class protected
    string

    The class to use for new instances.

Method Summary

Method Detail

newInstance() public

newInstance(mixed $locale, \Aura\Intl\Package $package, \Aura\Intl\FormatterInterface $formatter, ?\Aura\Intl\TranslatorInterface $fallback)

Returns a new Translator.

Parameters

string $locale

The locale code for the translator.

\Aura\Intl\Package $package

The Package containing keys and translations.

\Aura\Intl\FormatterInterface $formatter

The formatter to use for interpolating token values.

\Aura\Intl\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

Property Detail

$class protected

The class to use for new instances.

Type

string

© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.1/class-Cake.I18n.TranslatorFactory.html