getDomainPath() public method

Constructs and returns the full path to the translation files
public getDomainPath ( null $append = null ) : string
$append null
return string
示例#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;
 }
示例#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;
 }
 /**
  * Test the update 
  */
 public function testFileSystem()
 {
     // Domain path test
     $domainPath = $this->fileSystem->getDomainPath();
     // Locale path test
     $locale = 'es_AR';
     $localePath = $this->fileSystem->getDomainPath($locale);
     // Create locale test
     $localesGenerated = $this->fileSystem->generateLocales();
     $this->assertTrue($this->fileSystem->checkDirectoryStructure(true));
     $this->assertCount(3, $localesGenerated);
     $this->assertTrue(is_dir($domainPath));
     $this->assertTrue(strpos($domainPath, 'i18n') !== false);
     foreach ($localesGenerated as $localeGenerated) {
         $this->assertTrue(file_exists($localeGenerated));
     }
     $this->assertTrue(is_dir($localePath));
     // Update locale test
     $this->assertTrue($this->fileSystem->updateLocale($localePath, $locale, "backend"));
 }