fix calendar css, take 2. (#213)
[openemr.git] / interface / modules / zend_modules / library / Zend / I18n / View / Helper / AbstractTranslatorHelper.php
blob5e7cacd63edbcdd585fc665e602685f1da4abc39
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\I18n\View\Helper;
12 use Zend\I18n\Translator\TranslatorInterface as Translator;
13 use Zend\I18n\Translator\TranslatorAwareInterface;
14 use Zend\View\Helper\AbstractHelper;
16 abstract class AbstractTranslatorHelper extends AbstractHelper implements
17 TranslatorAwareInterface
19 /**
20 * Translator (optional)
22 * @var Translator
24 protected $translator;
26 /**
27 * Translator text domain (optional)
29 * @var string
31 protected $translatorTextDomain = 'default';
33 /**
34 * Whether translator should be used
36 * @var bool
38 protected $translatorEnabled = true;
40 /**
41 * Sets translator to use in helper
43 * @param Translator $translator [optional] translator.
44 * Default is null, which sets no translator.
45 * @param string $textDomain [optional] text domain
46 * Default is null, which skips setTranslatorTextDomain
47 * @return AbstractTranslatorHelper
49 public function setTranslator(Translator $translator = null, $textDomain = null)
51 $this->translator = $translator;
52 if (null !== $textDomain) {
53 $this->setTranslatorTextDomain($textDomain);
56 return $this;
59 /**
60 * Returns translator used in helper
62 * @return Translator|null
64 public function getTranslator()
66 if (! $this->isTranslatorEnabled()) {
67 return;
70 return $this->translator;
73 /**
74 * Checks if the helper has a translator
76 * @return bool
78 public function hasTranslator()
80 return (bool) $this->getTranslator();
83 /**
84 * Sets whether translator is enabled and should be used
86 * @param bool $enabled
87 * @return AbstractTranslatorHelper
89 public function setTranslatorEnabled($enabled = true)
91 $this->translatorEnabled = (bool) $enabled;
92 return $this;
95 /**
96 * Returns whether translator is enabled and should be used
98 * @return bool
100 public function isTranslatorEnabled()
102 return $this->translatorEnabled;
106 * Set translation text domain
108 * @param string $textDomain
109 * @return AbstractTranslatorHelper
111 public function setTranslatorTextDomain($textDomain = 'default')
113 $this->translatorTextDomain = $textDomain;
114 return $this;
118 * Return the translation text domain
120 * @return string
122 public function getTranslatorTextDomain()
124 return $this->translatorTextDomain;