有没有一种简单的方法可以在 URL 中使用 zend 路由和区域设置来强制加载特定区域设置?
例如 - http://domain.com/en-US/controller1/action
所以language-Region 应该为所有 URL 调用添加前缀,并且只在引导程序中设置区域设置,但让 MVC 路由的其余部分正常工作。
理想情况下,它可以检测 URL 中是否没有语言区域,并尝试从浏览器自动检测。
例如 - http://domain.com/ (如果未找到语言环境 - 默认为 en-US/index)
我我看过一些关于自定义用户虚荣网址等路由的文章。例如 - http://domain.com/username (路由到 http://domain.com/user/load/username)
对我来说,它似乎应该与此类似,但我想知道是否有更优雅的东西?
谢谢,
安德烈
Is there a simple way of using zend routes and locales in the URL to force the loading of a particular locale?
e.g. - http://domain.com/en-US/controller1/action
So the language-Region should prefix all URL calls and just set the locale in the bootstrap but let the rest of the MVC routing work as normal.
ideally it could detect if no language-Region is in the URL and attempt to autodetect from the browser.
e.g. - http://domain.com/ (if no locale is found - defaults to en-US/index)
I've seen some articles on routes for things like custom user vanity urls. e.g. - http://domain.com/username (routes to http://domain.com/user/load/username)
To me it seems like it should be similar to this, but I was wondering if there's something more elegant?
Thanks,
Andre
发布评论
评论(1)
我不想复制所有源代码,所以请查看
I dont want to copy over all the sourcecode, so have a look at