禁用特殊控制器的转换

发布于 2024-12-11 10:47:22 字数 166 浏览 5 评论 0原文

是否有可能禁用控制器的语言翻译器? 此示例控制器仅传送图像。

$this->_helper->layout->disableLayout();
$this->_helper->translator ???

TIA 马特

is there any possibility to disable the language translator for a controller?
This example controller only delivers images.

$this->_helper->layout->disableLayout();
$this->_helper->translator ???

TIA
Matt

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

素衣风尘叹 2024-12-18 10:47:22

如果您通过将翻译器包含在 Zend 注册表中来初始化 bootstrap 中的翻译器,也许您可​​以从控制器的 init() 方法中取消设置其中的 Zend_Translate 条目,这在引导程序之后调用。

取消设置 Zend_Registry 中的单个值 并不是那么微不足道。简而言之,您需要做这样的事情:

$registry = Zend_Registry::getInstance();
unset($registry['Zend_Translate']); 

希望有帮助,

If you initialize the translator in bootstrap by including it in the Zend Registry, maybe you could just unset the Zend_Translate entry in it from the init() method of the controller, which is called after the bootstrap.

Unsetting a single value in the Zend_Registry is not so trivial. In short, you need to do something like this:

$registry = Zend_Registry::getInstance();
unset($registry['Zend_Translate']); 

Hope that helps,

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文