getLocale() публичный метод

public getLocale ( ) : string
Результат string
Пример #1
0
 /**
  * Checks the required directory
  * Optionally checks each local directory, if $checkLocales is true
  *
  * @param bool|false $checkLocales
  * @return bool
  * @throws DirectoryNotFoundException
  */
 public function checkDirectoryStructure($checkLocales = false)
 {
     // Application base path
     if (!file_exists($this->basePath)) {
         throw new Exceptions\DirectoryNotFoundException(sprintf('Missing root path directory:  %s, check the \'base-path\' key in your configuration.', $this->basePath));
     }
     // Domain path
     $domainPath = $this->getDomainPath();
     // Translation files domain path
     if (!file_exists($domainPath)) {
         throw new Exceptions\DirectoryNotFoundException(sprintf('Missing base required directory: %s, remember to run \'artisan gettext:create\' the first time', $domainPath));
     }
     if (!$checkLocales) {
         return true;
     }
     foreach ($this->configuration->getSupportedLocales() as $locale) {
         // Default locale is not needed
         if ($locale == $this->configuration->getLocale()) {
             continue;
         }
         $localePath = $this->getDomainPath($locale);
         if (!file_exists($localePath)) {
             throw new Exceptions\DirectoryNotFoundException(sprintf('Missing locale required directory: %s, maybe you forgot to run \'artisan gettext:update\'', $locale));
         }
     }
     return true;
 }
Пример #2
0
 /**
  * Checks the needed directories. Optionally checks
  * each locale directory, if $checkLocales is true.
  *
  * @param bool $checkLocales
  * @return bool
  * @throws Exceptions\DirectoryNotFoundException
  */
 public function checkDirectoryStructure($checkLocales = false)
 {
     // Application base path
     if (!file_exists($this->basePath)) {
         throw new Exceptions\DirectoryNotFoundException("Missing root path directory: " . $this->basePath . ", check the 'base-path' key in your configuration.");
     }
     // Domain path
     $domainPath = $this->getDomainPath();
     // Translation files domain path
     if (!file_exists($domainPath)) {
         throw new Exceptions\DirectoryNotFoundException("Missing base required directory: {$domainPath}" . "<br>Remember run <b>artisan gettext:create</b> for first time.");
     }
     if ($checkLocales) {
         foreach ($this->configuration->getSupportedLocales() as $locale) {
             // Default locale is not needed
             if ($locale == $this->configuration->getLocale()) {
                 continue;
             }
             $localePath = $this->getDomainPath($locale);
             if (!file_exists($localePath)) {
                 $hint = "<br>May be you forget run <b>artisan gettext:update</b>?";
                 throw new Exceptions\DirectoryNotFoundException("Missing locale required directory: {$localePath}" . $hint);
             }
         }
     }
     return true;
 }