Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / I18n / Translator / TranslatorAwareTrait.php
blobd5bcefb6cdf72cae09e516136d7c4a752d905407
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-2013 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\Translator;
12 use Zend\I18n\Translator\Translator;
14 trait TranslatorAwareTrait
16 /**
17 * @var Translator
19 protected $translator = null;
21 /**
22 * @var bool
24 protected $translatorEnabled = true;
26 /**
27 * @var string
29 protected $translatorTextDomain = 'default';
31 /**
32 * Sets translator to use in helper
34 * @param Translator $translator
35 * @param string $textDomain
36 * @return mixed
38 public function setTranslator(Translator $translator = null, $textDomain = null)
40 $this->translator = $translator;
42 if (!is_null($textDomain)) {
43 $this->setTranslatorTextDomain($textDomain);
46 return $this;
49 /**
50 * Returns translator used in object
52 * @return Translator
54 public function getTranslator()
56 return $this->translator;
59 /**
60 * Checks if the object has a translator
62 * @return bool
64 public function hasTranslator()
66 return !is_null($this->translator);
69 /**
70 * Sets whether translator is enabled and should be used
72 * @param bool $enabled
73 * @return mixed
75 public function setTranslatorEnabled($enabled = true)
77 $this->translatorEnabled = $enabled;
79 return $this;
82 /**
83 * Returns whether translator is enabled and should be used
85 * @return bool
87 public function isTranslatorEnabled()
89 return $this->translatorEnabled;
92 /**
93 * Set translation text domain
95 * @param string $textDomain
96 * @return mixed
98 public function setTranslatorTextDomain($textDomain = 'default')
100 $this->translatorTextDomain = $textDomain;
102 return $this;
106 * Return the translation text domain
108 * @return string
110 public function getTranslatorTextDomain()
112 return $this->translatorTextDomain;