0

How I can obtain traslator locale in my view?

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.

Thank you!

josepmra
  • 617
  • 9
  • 25
  • If you don't care for certain stuff, please provide your use-case, too. Since that may influence the answer. tbp: what exactly do you want to do? – Sam Oct 25 '12 at 19:11

2 Answers2

3

You should try:

<?php echo \Locale::getDefault(); ?>

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.

DrBeza
  • 2,241
  • 1
  • 16
  • 18
0
<?php echo $this->plugin('translate')->getTranslator()->getLocale(); ?>

See: Get local value in layout or view in Zend Framework 2

Community
  • 1
  • 1
Neftalí Yagua
  • 360
  • 3
  • 10