Subversion Repositories LCARS

Compare Revisions

Last modification

Ignore whitespace Rev 191 → Rev 192

/trunk/media/video/series/application/views/IndexView.php
3,6 → 3,21
class IndexView extends \PointedEars\PHPX\View
{
/**
* @var \Zend\I18n\Translator\Translator
*/
private $_translator;
 
/**
* @var string
*/
private $_textDomain;
 
/**
* @var string
*/
private $_language;
 
/**
* Creates a new index view
*
* @see View::__construct()
10,5 → 25,39
public function __construct ($template)
{
parent::__construct('application/layouts/index/index.phtml');
 
require_once 'Zend/Loader/StandardAutoloader.php';
$loader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true));
$loader->register();
 
$translator = $this->_translator = new Zend\I18n\Translator\Translator();
// $translator->setCache(new Zend\Cache\Storage\*Adapter());
$type = 'gettext';
$base_dir = $_SERVER['DOCUMENT_ROOT'] . '/i18n/LocaleData';
$pattern = '%s/LC_MESSAGES/%1$s.pointedears.mo';
$text_domain = $this->_textDomain = 'de.pointedears';
$translator->addTranslationFilePattern($type, $base_dir, $pattern, $text_domain);
}
 
/**
* @param string $value
* @return IndexView
*/
public function setLanguage ($value)
{
$this->_language = $value;
return $this;
}
 
/**
* Returns the translation of the parameter, if any,
* using Zend Framework 2.1 Translate
*
* @param string $s
* @return string
*/
function _ ($s)
{
return $this->_translator->translate($s, $this->_textDomain, $this->_language);
}
}