Xinax\LaravelGettext\Config\Models\Config::getAllDomains PHP Méthode

getAllDomains() public méthode

Return an array with all domain names
public getAllDomains ( ) : array
Résultat array
    public function getAllDomains()
    {
        $domains = [$this->domain];
        // add the default domain
        foreach ($this->sourcePaths as $domain => $paths) {
            if (is_array($paths)) {
                array_push($domains, $domain);
            }
        }
        return array_unique($domains);
    }

Usage Example

Exemple #1
0
 /**
  * Adds a new locale directory + .po file
  *
  * @param  String                $localePath
  * @param  String                $locale
  * @throws FileCreationException
  */
 public function addLocale($localePath, $locale)
 {
     $data = array($localePath, "LC_MESSAGES");
     if (!file_exists($localePath)) {
         $this->createDirectory($localePath);
     }
     if ($this->configuration->getCustomLocale()) {
         $data[1] = 'C';
         $gettextPath = implode($data, DIRECTORY_SEPARATOR);
         if (!file_exists($gettextPath)) {
             $this->createDirectory($gettextPath);
         }
         $data[2] = 'LC_MESSAGES';
     }
     $gettextPath = implode($data, DIRECTORY_SEPARATOR);
     if (!file_exists($gettextPath)) {
         $this->createDirectory($gettextPath);
     }
     // File generation for each domain
     foreach ($this->configuration->getAllDomains() as $domain) {
         $data[3] = $domain . ".po";
         $localePOPath = implode($data, DIRECTORY_SEPARATOR);
         if (!$this->createPOFile($localePOPath, $locale, $domain)) {
             throw new FileCreationException(sprintf('Can\'t create the file: %s', $localePOPath));
         }
     }
 }
All Usage Examples Of Xinax\LaravelGettext\Config\Models\Config::getAllDomains