Search code examples
phpzend-frameworkurlrouteszend-translate

Translating URLs ZendFramework


I have been using zend translate to translate the site content but what about the urls? How could I translate it?

Ex.:
localhost/app/contact (English)
localhost/app/contato (Portuguese)


Solution

  • If you are indeed using Zend Translate you should be able to use translations in your router like:

    routes.someroute.route = "/:langparam/@translateme"
    routes.someroute.defaults.module = public
    routes.someroute.defaults.controller = page
    routes.someroute.defaults.action = show
    

    If your translation source contains 'translateme' it wil be translated, if not the router will use 'translateme' as value.