zend framework 2从视图PhpRenderer获取区域设置 [英] zend framework 2 get locale from view PhpRenderer
本文介绍了zend framework 2从视图PhpRenderer获取区域设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在我的视图中获取翻译器语言环境?
How I can obtain traslator locale in my view?
我想从变量$ this(视图的PhpRenderer)开始. 也就是说,我不想使用onBootstrap或ActionController,因为我不在乎拥有视图变量.
I want to do it starting from the variable $this (the PhpRenderer of the view). i.e. I don't want use onBootstrap nor ActionController because I don't care to have a view variables.
谢谢!
推荐答案
您应该尝试:
<?php echo \Locale::getDefault(); ?>
许多I18n类都引用了PHP的Locale类(http://www.php.net/locale)-因此,我认为这将是一个很好的起点.
Many of the I18n classes make reference to PHP's Locale class (http://www.php.net/locale) - so in my opinion that would be a good starting point.
这篇关于zend framework 2从视图PhpRenderer获取区域设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文