]> dev.renevier.net Git - syj.git/blob - application/views/helpers/LocaleShort.php
redirection after path creation is decided by server (php), not guessed by client...
[syj.git] / application / views / helpers / LocaleShort.php
1 <?php
2 /*  This file is part of Syj, Copyright (c) 2010 Arnaud Renevier,
3     and is published under the AGPL license. */
4
5 class Syj_View_Helper_LocaleShort extends Zend_View_Helper_Abstract
6 {
7     public function localeShort() {
8         $translator = $this->view->getHelper('translate')->getTranslator();
9         $locale = $translator->getLocale();
10         if (!($translator->isAvailable($locale))) {
11             $defaults = Zend_Locale::getDefault();
12             arsort($defaults);
13             $locale = key($defaults);
14         }
15         $locale = new Zend_Locale($locale);
16         return $locale->getLanguage();
17     }
18 }