I would like to see a better "user case" because it is not clear to me
the example you are using here, but the "concept" is quite useful.
Personnally, all my projects are "multilingual" and thinking in SEO
and "recordability" it is quite useful to "localizate" the URLs in the
different languages. I have become to another solution in my projects,
but think this approach could be better.
El 12 Dec 2008, a las 23:03, Marco Pracucci escribió:
> Hi,
>
> I have created a route that translates url segments. This route can
> be used for those web applications that needs url translated into
> different languages. For example, en.domain.com can have urls
> translated to english, while it.domain.com urls can be translated to
> italian language.
>
> How to use it:
>
> Zend_Registry::set('Zend_Translate', new Zend_Translate('gettext', '/
> path/to/translation', $lang));
>
> $router->addRoute('article', new
> Zend_Controller_Router_Route_Translate(
> '/;shop/;item/:id',
> array(
> 'controller' => 'article',
> 'action' => 'view'
> )));
>
> Routing:
>
> $lang = 'en' => /show/item/:id
> $lang = 'it' => /negozio/articolo/:id
>
> You can take a look at the class here:
> http://download.pracucci.com/php/zf/Zend_Controller_Router_Route_Translate.php.txt
> (it also supports lazy initialization)
>
>
> May you give me a feedback?
> Do you think it could be proposed to Zend, with some fixes and
> modifications?
>
> Thanks,
> Marco Pracucci
>
没有评论:
发表评论