Zend_Controller_Router_Route_Regex 反向路由未转换
这就是我的路线的样子:
acc_long.type = Zend_Controller_Router_Route_Regex
acc_long.route = "@accommodation/([A-Za-z-]+)/([0-9A-Za-z-]+)-([0-9]+)"
acc_long.map.1 = 'location'
acc_long.map.2 = 'name'
acc_long.map.3 = 'id'
acc_long.defaults.controller = "accommodation"
acc_long.defaults.action = "index"
acc_long.defaults.module = "default"
acc_long.defaults.location = 'FALSE'
acc_long.defaults.name = 'FALSE'
acc_long.defaults.id = 'FALSE'
acc_long.reverse = "@accommodation/%s/%s-%d/"
但是 zend router 不会将其翻译成特定语言,例如德语。 我有所有可用的翻译,并且路线翻译在除正则表达式路线之外的所有路线中都工作正常?
有没有办法也翻译一下?
非常感谢!
This is how my route looks like:
acc_long.type = Zend_Controller_Router_Route_Regex
acc_long.route = "@accommodation/([A-Za-z-]+)/([0-9A-Za-z-]+)-([0-9]+)"
acc_long.map.1 = 'location'
acc_long.map.2 = 'name'
acc_long.map.3 = 'id'
acc_long.defaults.controller = "accommodation"
acc_long.defaults.action = "index"
acc_long.defaults.module = "default"
acc_long.defaults.location = 'FALSE'
acc_long.defaults.name = 'FALSE'
acc_long.defaults.id = 'FALSE'
acc_long.reverse = "@accommodation/%s/%s-%d/"
But zend router doesn't translate it into a specific language, to german for example.
I have all the translations available, and translation of routes is working fine in all routes except for Regex route?
Is there any way to translate it also?
Thank you very much!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
解决方案是使用链接,
所以路由的“静态”部分是一个单独的路由。
例如
,它就像一个魅力!
The solutiuon is to use chaining,
so the "static" part of the route is a separate route.
for example
And it works like a charm!
您是否尝试过设置默认翻译器?
Zend_Controller_Router_Route::setDefaultTranslator($translator);
http: //framework.zend.com/manual/en/zend.controller.router.html#zend.controller.router.routes.standard.translated-segments
Have you tried setting the default translator?
Zend_Controller_Router_Route::setDefaultTranslator($translator);
http://framework.zend.com/manual/en/zend.controller.router.html#zend.controller.router.routes.standard.translated-segments