1) I have a controller "calendar" and have action "showDate" which gets date via url. So, url is something like "calendar/show-date/date/2012-07-22"
2) I have a link to display all entries, "calendar/"
So, I want to create routes so my links look like "kalendar/2012-07-22" and "kalendar/".
Can anyone help me?
You have to setup custom routes, this is my way:
in folder application/configs/ create file named "routes.ini"
Put in file your route:
So in your bootstrap.php define that config file:
And that's it, you can call URL
www.website.com/kalendar
and
www.website.com/kalendar/2012-1-1
See answers in this question for details: Simple rewrites in Zend Framework
I've been looking into translating the URL with Zend_Translate and I came across this sites' plugin that attempts to auto-translate URL segments (module/controller/action).
http://blog.helmich.cz/305-howto-simple-multilingual-routes-in-zend-framework/
The nice thing is that it's a modified custom router class that can function similar to Zend_Router so it's relatively familiar off the bat.
The thing you'll need is to have a language ID in your URL (called :locale in the above example) so your Zend_Translate can set the proper language.
I've only slightly played around with this concept but I recall that it had promise. You'll have to get more familiar with Zend_Translate: http://framework.zend.com/manual/en/zend.translate.html
I hope that helps!
Cheers!
According to this post: http://www.z-f.fr/forum/viewtopic.php?id=5138
The solution is to add '@locale' => $lang to the params.
It works very well for me.
You could re-route all calls of calendar to kalendar. There are two possibilites, either you do it with Zend (preferable) or you change your webserver configuration to rewrite calls to calendar with a HTTP 302 (ugly).
You should however consult the official Zend Documentation, which is pretty good