public function getTranslator($locale = null, $encoding = null)
    {
        // if no locale was passed use the active one
        if ($locale === null) {
            $locale = $this->getLocale();
        }

        // Check if locale is available on system
        $availableLocales = $this->getAvailableLocales();

        if (false === in_array($locale, $availableLocales)) {
            throw new Doozr_I18n_Service_Exception(
                sprintf('The locale "%s" is not available by configuration.', $locale)
            );
        }

        // if no encoding was passed use the active one
        if ($encoding === null) {
            $encoding = $this->getEncoding();
        }

        // retrieve valid input
        $input = $this->validateInput($locale);

        // check for redirect
        if (isset($input['redirect'])) {
            $translator = $this->getTranslator($input['redirect'], $encoding);
        } else {
            $translator = new Doozr_I18n_Service_Translator($locale, $encoding, self::$config, $input['configuration']);
        }

        return $translator;
    }
public function getTranslator($locale = null, $encoding = null)
    {
        // if no locale was passed use the active one
        if ($locale === null) {
            $locale = $this->getLocale();
        }

        // Check if locale is available on system
        $availableLocales = $this->getAvailableLocales();

        if (false === in_array($locale, $availableLocales)) {
            throw new Doozr_I18n_Service_Exception(
                sprintf('The locale "%s" is not available by configuration.', $locale)
            );
        }

        // if no encoding was passed use the active one
        if ($encoding === null) {
            $encoding = $this->getEncoding();
        }

        // retrieve valid input
        $input = $this->validateInput($locale);

        // check for redirect
        if (isset($input['redirect'])) {
            $translator = $this->getTranslator($input['redirect'], $encoding);
        } else {
            $translator = new Doozr_I18n_Service_Translator($locale, $encoding, self::$config, $input['configuration']);
        }

        return $translator;
    }
public function getTranslator ( $ locale = null , $ encoding = null ) { // if no locale was passed use the active one if ( $ locale === null ) { $ locale = $ this -> getLocale ( ) ; } // Check if locale is available on system $ availableLocales = $ this -> getAvailableLocales ( ) ; if ( false === in_array ( $ locale , $ availableLocales ) ) { throw new Doozr_I18n_Service_Exception ( sprintf ( 'The locale "%s" is not available by configuration.' , $ locale ) ) ; } // if no encoding was passed use the active one if ( $ encoding === null ) { $ encoding = $ this -> getEncoding ( ) ; } // retrieve valid input $ input = $ this -> validateInput ( $ locale ) ; // check for redirect if ( isset ( $ input [ 'redirect' ] ) ) { $ translator = $ this -> getTranslator ( $ input [ 'redirect' ] , $ encoding ) ; } else { $ translator = new Doozr_I18n_Service_Translator ( $ locale , $ encoding , self :: $ config , $ input [ 'configuration' ] ) ; } return $ translator ; }
Returns an translator instance for passed locale.

@param string $locale   The locale to return translator for
@param string $encoding The encoding of the translation

@author Benjamin Carl <opensource@clickalicious.de>

@return Doozr_I18n_Service_Translator An instance of the locale-detector

@throws Doozr_I18n_Service_Exception
Returns an translator instance for passed locale .