You're in the army now
Posts tagged router
translate($this)
Nov 26th
So I needed to set up a translatable website and thought I would re-visit the way I use the translate component from the Zend framework. Previously I set up the translate component and would then create a plugin to handle the language change which I would trigger by changing a session variable.
Although this works I tended to feel it was a bit slap dash and that there must be a more efficient and useful way of utilising the component without the need to utilise a plugin.
So having had a nose around the net I decided that I wanted to make the language URL driven. I also wanted to steer away from using a subdomain to drive the language selection (i.e. en.website.com/pagename) and wanted it to be a part of the url (i.e. website.com/en/pagename) as this was more in keeping of the style of site I like to use.
So with a little tweaking code and utilising both the Locale, Translate and Router Resources here is how I did it.
More >

