-----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-----

<<attachment: Translatable.php>>

Attachment: Translatable.php.sig
Description: PGP signature

Reply via email to