protected function _initTranslate()
    {
        $this->bootstrap('locale');

        $language = $this->locale->getLanguage();

        /*
         * Scan for files with -<languagecode> and disable notices when the requested
         * language is not found
         */
        $options = array( 'adapter'         => 'gettext',
                          'content'         => GEMS_LIBRARY_DIR . '/languages/',
                          'disableNotices'  => true,
                          'scan'            => \Zend_Translate::LOCALE_FILENAME);

        $translate = new \Zend_Translate($options);

        // If we don't find the needed language, use a fake translator to disable notices
        if (! $translate->isAvailable($language)) {
            $translate = \MUtil_Translate_Adapter_Potemkin::create();
        }

        //Now if we have a project specific language file, add it
        $projectLanguageDir = APPLICATION_PATH . '/languages/';
        if (file_exists($projectLanguageDir)) {
            $options['content']        = $projectLanguageDir;
            $options['disableNotices'] = true;
            $projectTranslations       = new \Zend_Translate($options);
            //But only when it has the requested language
            if ($projectTranslations->isAvailable($language)) {
                $translate->addTranslation(array('content' => $projectTranslations));
            }
            unset($projectTranslations);  //Save some memory
        }

        $translate->setLocale($language);
        \Zend_Registry::set('Zend_Translate', $translate);

        // Fix for _init resource being case insensitive
        $container = $this->getContainer();
        $adapter   = $translate->getAdapter();
        $container->translateAdapter = $adapter;
        $this->translateAdapter      = $adapter;

        return $translate;
    }
protected function _initTranslate()
    {
        $this->bootstrap('locale');

        $language = $this->locale->getLanguage();

        /*
         * Scan for files with -<languagecode> and disable notices when the requested
         * language is not found
         */
        $options = array( 'adapter'         => 'gettext',
                          'content'         => GEMS_LIBRARY_DIR . '/languages/',
                          'disableNotices'  => true,
                          'scan'            => \Zend_Translate::LOCALE_FILENAME);

        $translate = new \Zend_Translate($options);

        // If we don't find the needed language, use a fake translator to disable notices
        if (! $translate->isAvailable($language)) {
            $translate = \MUtil_Translate_Adapter_Potemkin::create();
        }

        //Now if we have a project specific language file, add it
        $projectLanguageDir = APPLICATION_PATH . '/languages/';
        if (file_exists($projectLanguageDir)) {
            $options['content']        = $projectLanguageDir;
            $options['disableNotices'] = true;
            $projectTranslations       = new \Zend_Translate($options);
            //But only when it has the requested language
            if ($projectTranslations->isAvailable($language)) {
                $translate->addTranslation(array('content' => $projectTranslations));
            }
            unset($projectTranslations);  //Save some memory
        }

        $translate->setLocale($language);
        \Zend_Registry::set('Zend_Translate', $translate);

        // Fix for _init resource being case insensitive
        $container = $this->getContainer();
        $adapter   = $translate->getAdapter();
        $container->translateAdapter = $adapter;
        $this->translateAdapter      = $adapter;

        return $translate;
    }
protected function _initTranslate ( ) { $ this -> bootstrap ( 'locale' ) ; $ language = $ this -> locale -> getLanguage ( ) ; /*
         * Scan for files with -<languagecode> and disable notices when the requested
         * language is not found
         */ $ options = array ( 'adapter' => 'gettext' , 'content' => GEMS_LIBRARY_DIR . '/languages/' , 'disableNotices' => true , 'scan' => \ Zend_Translate :: LOCALE_FILENAME ) ; $ translate = new \ Zend_Translate ( $ options ) ; // If we don't find the needed language, use a fake translator to disable notices if ( ! $ translate -> isAvailable ( $ language ) ) { $ translate = \ MUtil_Translate_Adapter_Potemkin :: create ( ) ; } //Now if we have a project specific language file, add it $ projectLanguageDir = APPLICATION_PATH . '/languages/' ; if ( file_exists ( $ projectLanguageDir ) ) { $ options [ 'content' ] = $ projectLanguageDir ; $ options [ 'disableNotices' ] = true ; $ projectTranslations = new \ Zend_Translate ( $ options ) ; //But only when it has the requested language if ( $ projectTranslations -> isAvailable ( $ language ) ) { $ translate -> addTranslation ( array ( 'content' => $ projectTranslations ) ) ; } unset ( $ projectTranslations ) ; //Save some memory } $ translate -> setLocale ( $ language ) ; \ Zend_Registry :: set ( 'Zend_Translate' , $ translate ) ; // Fix for _init resource being case insensitive $ container = $ this -> getContainer ( ) ; $ adapter = $ translate -> getAdapter ( ) ; $ container -> translateAdapter = $ adapter ; $ this -> translateAdapter = $ adapter ; return $ translate ; }
Initialize the translate component.

Scans the application and project dirs for available translations

Use $this->translate to access afterwards
Also sets $this->translateAdapter to access afterwards

@return \Zend_Translate
Initialize the translate component .