Example #1
0
 /**
  * Sets the current domain and updates gettext domain application
  *
  * @param   String                      $domain
  * @throws  UndefinedDomainException    If domain is not defined
  * @return  self
  */
 public function setDomain($domain)
 {
     if (!in_array($domain, $this->configuration->getAllDomains())) {
         throw new UndefinedDomainException("Domain '{$domain}' is not registered.");
     }
     bindtextdomain($domain, $this->fileSystem->getDomainPath());
     bind_textdomain_codeset($domain, $this->encoding);
     $this->domain = textdomain($domain);
     return $this;
 }
Example #2
0
 /**
  * Sets the current domain and updates gettext domain application
  *
  * @param   String                      $domain
  * @throws  UndefinedDomainException    If domain is not defined
  * @return  self
  */
 public function setDomain($domain)
 {
     if (!in_array($domain, $this->configuration->getAllDomains())) {
         throw new UndefinedDomainException("Domain '{$domain}' is not registered.");
     }
     $customLocale = $this->configuration->getCustomLocale() ? "/" . $this->getLocale() : "";
     bindtextdomain($domain, $this->fileSystem->getDomainPath() . $customLocale);
     bind_textdomain_codeset($domain, $this->getEncoding());
     $this->domain = textdomain($domain);
     return $this;
 }
 /**
  * Clear all files generated for testing purposes
  */
 protected function clearFiles()
 {
     $dir = __DIR__ . '/../lang/i18n';
     FileSystem::clearDirectory($dir);
 }