Ugh, maybe I should have given an example of what I have done so far, no? ;-)
Here goes:


// bootstrap
// ROUTES SETUP - Setup routes
$router = $frontController->getRouter();
$router->removeDefaultRoutes();

$defaultRoute = new nl_indetail_Controller_Router_Route_Translatable(
 ':@module/:@controller/:@action/*',
 array(
        'module' => 'default',
        'controller' => 'index',
        'action' => 'index'
 )
);
$router->addRoute( 'default', $defaultRoute );

$defaultModuleRoute = new nl_indetail_Controller_Router_Route_Translatable(
 ':@controller/:@action/*',
 array(
        'module' => 'default',
        'controller' => 'index',
        'action' => 'index'
 )
);
$router->addRoute( 'defaultModule', defaultModuleRoute );



From: fire-eyed-...@hotmail.com
To: fw-general@lists.zend.com
Date: Thu, 12 Mar 2009 14:23:07 +0000
Subject: RE: [fw-general] Zend_Controller_Router_Route & Zend_Translate?








Ben,

I am implementing your Zend_Controller_Router_Route_Translatable right now. It 
works very nice. One thing I have a hard time figuring out though, is the 
following: 


How would I be able to mimic the default ZF route including optional modules, 
for instance such that:
/nieuwsbrief/aanmelden (newsletter/subscribe in Dutch)
routes to NewsletterController->subscribeAction() (default module)

/beheerder/pagina/bewerken (admin/page/edit in Dutch)
could route to Admin_PageController->editAction() (admin module)

Any ideas? Thanks in advance.


From: fire-eyed-...@hotmail.com
To: fw-general@lists.zend.com
Date: Fri, 27 Feb 2009 19:24:24 +0000
Subject: RE: [fw-general] Zend_Controller_Router_Route & Zend_Translate?








Ben,

I'll have to get my head around it a little more. But at first glance,  this 
looks absolutely perfect for the job: just what I was looking for. Thanks a lot!


> Date: Fri, 27 Feb 2009 19:36:47 +0100
> From: m...@dasprids.de
> To: fw-general@lists.zend.com
> Subject: Re: [fw-general] Zend_Controller_Router_Route & Zend_Translate?
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hehe, we just had the same topic some days ago. I solved the same
> problem some time ago, with simply a new route (which
> i will probably port to ZF in modified way some day). It works like this:
> 
> Fixed text is prepended with an @, while translatable parameters are
> prepended with :@. For example:
> 
> route.about.type  = 'App_Controller_Router_Route_Translatable
> route.about.route = '@imprint'
> 
> Now, the route looks for a Zend_Translate instance with the key
> Zend_Translate within Zend_Registry, searches for the message-id
> "imprint", translates it, and then tries to match the route.
> 
> There are also translatable parameters as said before:
> 
> route.statistics.type  = 'App_Controller_Router_Route_Translatable
> route.statistics.route = '@statistics/:@timerange'
> 
> Here again, "statistics" is simply translated and matches. What the
> :@timerange parameter does is the following:
> 
> When you assemble the route like this:
> 
> $urlHelper->url(array('timerange' => 'this-month'), 'statistics');
> 
> The route looks for a message with the id "this-month" and if available,
> puts it into the url, else the message id itself. When matching a URL,
> it replaces the translated parameter with the message id again, so you
> don't have to care about it in your application itself.
> 
> For the route code, see the attached file.
> 
> Regards,
> Ben
> ...................................
> :  ___   _   ___ ___ ___ _ ___    :
> : |   \ /_\ / __| _ \ _ (_)   \   :
> : | |) / _ \\__ \  _/   / | |) |  :
> : |___/_/:\_\___/_| |_|_\_|___/   :
> :........:........................:
> : Web    : http://www.dasprids.de :
> : E-mail : m...@dasprids.de       :
> : Jabber : jab...@dasprids.de     :
> : ICQ    : 105677955              :
> :........:........................:
> 
> 
> fire-eyed-...@hotmail.com schrieb:
> > Hi y'all,
> > 
> > Is there any easy way to implement routes such that they honour
> > translations as well, without having to manually create routes for them?
> > 
> > For instance:
> > /gebruiker/aanmelden
> > /benutzer/anmelden
> > Should both route to
> > /user/sign-up
> > 
> > Or something similar.
> > 
> > Cheers
> > 
> > ------------------------------------------------------------------------
> > Deel en publiceer je favoriete foto's met Windows Live Photos
> > <www.photos.live.com>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iEYEARECAAYFAkmoMrwACgkQ0HfT5Ws789Di2wCdFPoG4xyooS/VDQ8Q1OVYTWZi
> NSIAn1N4NvuZbftpFiQnRJumFvvKQH2A
> =b4Va
> -----END PGP SIGNATURE-----

Deel en publiceer je favoriete foto's met Windows Live Photos
Ook nieuwsgierig naar de nieuwe Messenger? Download 'm hier
_________________________________________________________________
De leukste online filmpjes vind je op MSN Video!
http://video.msn.com/video.aspx?mkt=nl-nl

Reply via email to