Zend Framework 和切换视图脚本路径
我有一个问题。基本上,根据用户是否访问我们网站上的 /es 或 /br 或 /cn 等,我们有不同的语言模板文件。到目前为止,我们使用自定义模板引擎来完成这项工作,但正在切换到 ZF。如果语言变量是 cn,我似乎无法弄清楚如何让 ZF 在 cn/about-us 中查找视图脚本。
我不能(不想)为此使用 Zend_Translate,因为我们有太多翻译的模板文件,并且使用 Zend_Translate 来处理无数包含中文/韩文/日文多段落的不同文件是不可行的,忘记了一秒钟我不会说这些语言。
有人可以帮助我吗?
I have a problem. Basically, depending on whether a user goes to /es or /br or /cn etc on our website, we have different language template files. So far, we were using a custom templating engine to make this work, but are making a switch over to ZF. I can't seem to figure out how to get ZF to look for a view script in say cn/about-us if the language varuable is cn.
I can't (don't want to) use Zend_Translate for this because we have way too many translated template files and it's just not feasible using Zend_Translate for bazillion different files with multi-paragraphs of Chinese/Korean/Japanese, forgetting for a second that I don't speak those languages.
Can anybody help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以编写一个控制器插件并使用它的routeStartup()方法来更改Zend_View设置(视图脚本所在的路径)并在路由开始之前更改请求uri。
You can write a controller plugin and use it's routeStartup() method to alter Zend_View settings (path to where your view scripts are located) and change the request uri before routing starts.