+ Reply to Thread
Results 1 to 3 of 3

Thread: Router Translate troubles with modules

  1. #1
    whisher is offline Member
    Join Date
    May 2009
    Location
    Kakiland
    Posts
    32

    Default Router Translate troubles with modules

    Hi.
    I should set up a router with dynamic translation for a better SEO
    I ended up with this code
    Code:
    public function routeStartup(Zend_Controller_Request_Abstract $request) 
        {   
            //$this->_layout = Zend_Controller_Action_HelperBroker::getStaticHelper('Layout'); 
            // $this->_view = $this->_layout->getView(); 
             try{ 
                $i18n = Zend_Registry::get('i18n'); 
                $locale = $i18n['locale']; 
                $lang =   $i18n['lang']; 
            } 
            catch(Zend_Exception $e){ 
                $locale = self::DEFAULT_LOCAL; 
                $lang =   self::DEFAULT_LANG; 
            } 
            
            
            $zl = new Zend_Locale(); 
            $zl->setLocale($locale); 
            Zend_Registry::set('Zend_Locale', $zl); 
            
            $fileName = APPLICATION_PATH . '/configs/lang/'. $lang . '.php'; 
            if(!file_exists($fileName)){ 
                $fileName = APPLICATION_PATH . '/configs/lang/'. self::DEFAULT_LANG . '.php'; 
            } 
            if(strpos($lang, '_') !== false){ 
                list($lang,$region)= explode('_',$lang); 
            } 
            $translate = new Zend_Translate('array', $fileName , $lang); 
            Zend_Registry::set('Zend_Translate', $translate); 
            Zend_Form::setDefaultTranslator($translate); 
            $route = new Zend_Controller_Router_Route( 
                ':module/:@controller/:@action/*', 
                   array( 
                   'module'=>'default', 
                    'controller' => 'index', 
                     'action'     => 'index' 
                   ) 
            ); 
            
            $this->_router->addRoute('default', $route); 
        }
    it works with

    en
    default/live/write
    it
    default/dalvivo/scrivi
    en
    admin/login
    it
    admin/logati

    but it doesn't work with
    en
    live/write
    it
    dalvivo/scrivi

    even if I have
    'module'=>'default'


    Can you help me please ?
    Bye.


    Whisher

  2. #2
    tjorriemorrie is offline Member
    Join Date
    Mar 2009
    Posts
    68

    Default

    I have no clue about this but maybe look at this

  3. #3
    whisher is offline Member
    Join Date
    May 2009
    Location
    Kakiland
    Posts
    32

    Default

    Thanks for the link but I've just peeped into it
    Excellent stuff

    Bye

+ Reply to Thread

Similar Threads

  1. translate each expression according his html id
    By Yosef in forum General Q&A on Zend Framework
    Replies: 0
    Last Post: 07-08-2010, 12:37 PM
  2. Router/Modules help
    By prasanthbpillai in forum Model-View-Controller (MVC)
    Replies: 9
    Last Post: 07-29-2009, 05:26 PM
  3. Bootstrap breadcrumbs troubles
    By whisher in forum Model-View-Controller (MVC)
    Replies: 3
    Last Post: 06-05-2009, 01:57 AM
  4. Simple Router (modules)
    By muan in forum Model-View-Controller (MVC)
    Replies: 1
    Last Post: 05-18-2009, 08:06 AM
  5. $translate->isAvailable() always true?
    By PoolSnoopy in forum Internationalization (i18n) & Localization (l10n)
    Replies: 2
    Last Post: 03-29-2009, 07:28 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts