> Hi,
>
> The same subject again and again. Adding the locale into URL to simulate a
> "one folder per language" structure with MVC.
>
> Just like the official Zend website does, but how exactly ? :)
>
> It's really complicated to add this behaviour with Zend routes and by
> browsing forums i never found a viable solution.
>
> The solution that comes up most often is :
> - redefine default routes
> - a plugin to get lang param and initialize Zend_Locale/Zend_Translate
>
> But that's not enough !
>
> We need to handle the following cases :
> - the lang param is not valid
> - the lang param is missing (ex. http://www.my-website.com/contact has to
> be redirected to http://www.my-website.com/defaultlang/contact)
>
> Let's assume an user enter the following url :
> http://www.my-website.com/dsqdsq, we have to return a 404 error page,
> handled by the ErrorHandler plugin.
>
> But that's not possible, in our plugin we will get "dsqdsq" as the lang
> param value and throwing manually a 404 error from within a plugin is not
> handled by the ErrorHandler.
>
> Plus, we will maybe have to redirect automatically the user to :
> "http://www.my-website.com/en-gb/dsqdsq", but "dsqdsq" is a module ? a
> controller ? an action ? Who knows and how to redirect to a good url.
>
> In other words, if the first param is not a valid lang, we have to add the
> default language to the url and shift all the parts of the url
> (complicated).
>
> I'm wasting a loooot of precious time with that stuff ! :)
>
> Is there a solution that works for all cases ? Maybe with apache rewrite
> rules ?
>
>
> Thanks. (and sorry if my english is sometimes hard :p)
>
> Cdt,
> Benjamin.
Hi Benjamin, this (1) screen cast helped me a lot when dealing with languages.
Hope it helps the way it did for me.
(1) http://www.zendcasts.com/introducing-zend_translate/2009/11/
Slds!
--
Damián Farina
XoomCode
没有评论:
发表评论