src/I18n/I18n.php
public function translator(string $locale, string $domain, string $directory): ?TranslatorInterface
    {
        $class = GETTEXT_EXTENSION ? GettextTranslator::class : Translator::class;

        $previous = self::$translator;
        self::$translator = new $class($locale, $domain, $directory);

        if ($previous === null) {
            require __DIR__ . DIRECTORY_SEPARATOR . 'helpers.php';
        }

        $this->locale = $locale;

        return $previous;
    }
public function translator(string $locale, string $domain, string $directory): ?TranslatorInterface
    {
        $class = GETTEXT_EXTENSION ? GettextTranslator::class : Translator::class;

        $previous = self::$translator;
        self::$translator = new $class($locale, $domain, $directory);

        if ($previous === null) {
            require __DIR__ . DIRECTORY_SEPARATOR . 'helpers.php';
        }

        $this->locale = $locale;

        return $previous;
    }
public function translator ( string $ locale , string $ domain , string $ directory ) : ? TranslatorInterface { $ class = GETTEXT_EXTENSION ? GettextTranslator :: class : Translator :: class ; $ previous = self :: $ translator ; self :: $ translator = new $ class ( $ locale , $ domain , $ directory ) ; if ( $ previous === null ) { require __DIR__ . DIRECTORY_SEPARATOR . 'helpers.php' ; } $ this -> locale = $ locale ; return $ previous ; }
Initialize a new gettext class

@param string $directory
@param string $domain
@param string $locale

@return TranslatorInterface|null
Initialize a new gettext class