+
+
+
+ public function translate($k)
+ {
+ if ($this->_translator && $this->_translator_enabled) {
+ return $this->_translator->translate($k, $this->_textDomain);
+ }
+ return $k . '(Non traduit)';
+ }
+
+
+ public function setTranslator(Translator $translator = null, $textDomain = null)
+ {
+ $this->_translator = $translator;
+ $this->_textDomain = $textDomain;
+ }
+
+ public function getTranslator()
+ {
+ return $this->_translator;
+ }
+
+ public function hasTranslator()
+ {
+ return $this->_translator !== null;
+ }
+
+ public function setTranslatorEnabled($enabled = true)
+ {
+ $this->_translator_enabled = $enabed;
+ }
+
+ public function isTranslatorEnabled()
+ {
+ return $this->_translator_enabled;
+ }
+
+ public function setTranslatorTextDomain($textDomain = 'default')
+ {
+ $this->_textDomain = $textDomain;
+ }
+
+ public function getTranslatorTextDomain()
+ {
+ return $this->_textDomain;
+ }
+