Some time ago I had to create a project that supported multiple languages. I struggled to get it right without making a mess of my routes. After some research I managed to created a good sollution for this problem.

    Normally a url is build up like this:
    http://domain.com/controller/action/

    What we want to do is create routes that let us create these url’s
    http://domain/language/controller/action/

    The routes config should look like this:

    routes.module.type          = Zend_Controller_Router_Route_Module
    routes.module.abstract      = On  
    
    routes.route.type           = Zend_Controller_Router_Route
    routes.route.route          = ":language"
    routes.route.reqs.lang      = "^(en|nl|de|fr|es|it)$"
    routes.route.defaults.lang  = "en"
    routes.chain.type           = Zend_Controller_Router_Route_Chain
    routes.chain.chain          = "route,module"

    All you need to do now is initialize these routes and you can add the languages to your url.

    Featured Video

    Twitter updates