Return all language messages.

@throws \Exception

@return array
329984
protected function getMessages(): array
    {
        $messages = [];

        foreach (array_merge(array_values(app('translation.loader')->namespaces()), [$this->sourcePath]) as $directory) {
            foreach ($this->file->allFiles($directory) as $file) {
                $path = mb_substr($file->getPath(), 0, mb_strrpos($file->getPath(), DIRECTORY_SEPARATOR));
                $namespace = array_search($path, app('translation.loader')->namespaces());

                $pathName = $file->getRelativePathName();
                $extension = $file->getExtension();
                if (! in_array($extension, ['json', 'php'])) {
                    continue;
                }

                if ($this->isMessagesExcluded($pathName)) {
                    continue;
                }

                $key = mb_substr($pathName, 0, -4);
                $key = str_replace('\\', '.', $key);
                $key = str_replace('/', '.', $key);

                if ($namespace) {
                    $key = mb_substr($key, 0, mb_strpos($key, '.') + 1).str_replace('/', '.', $namespace).'::'.mb_substr($key, mb_strpos($key, '.') + 1);
                }

                if (starts_with($key, 'vendor')) {
                    $key = $this->getVendorKey($key);
                }

                if ($extension === 'php') {
                    $messages[$key] = include $file->getRealPath();
                } else {
                    $key = $key.$this->stringsDomain;
                    $fileContent = file_get_contents($file->getRealPath());
                    $messages[$key] = json_decode($fileContent, true);
                }
            }
        }

        $this->sortMessages($messages);

        return $messages;
    }
453517
public function getAvailableLanguages()
    {
        $languages = [];

        $paths = $this->fileSystem->getDirectories($this->getLanguagesPath());

        foreach ($paths as $path) {
            $languages[] = substr($path, strlen($this->getLanguagesPath()) + 1);
        }

        return $languages;
    }
1362886
protected function getMessagesJson()
    {
        $messages = MessageCachingService::getMessagesJson();
        $messages = $this->ensureBackwardsCompatibility($messages);

        $contents  = 'Lang.addMessages(' . $messages . ');';

        return $contents;
    }
958467
protected function getMessages()
    {
        $msgs = array();
        // Read something.
        $read = @fread($this->socket, 65535);
        if ($read === false || @feof($this->socket)) {
            throw new ClientException('Error reading');
        }
        $this->currentProcessingMessage .= $read;
        // If we have a complete message, then return it. Save the rest for
        // later.
        while (($marker = strpos($this->currentProcessingMessage, Message::EOM))) {
            $msg = substr($this->currentProcessingMessage, 0, $marker);
            $this->currentProcessingMessage = substr(
                $this->currentProcessingMessage,
                $marker + strlen(Message::EOM)
            );
            $msgs[] = $msg;
        }
        return $msgs;
    }
1161034
public function listLanguages(): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/languages', $this->getOwner(),
            $this->getRepo()));
    }
63439
public function getAllMessages($language = null) {
	
		$this->loadAllMessages();

		// The array of messages by message, then by language:
		// array(message_key => array(language => message))
		$msgs = array();
	
		$keys = $this->getAllKeys();
	
		$languages = $this->getSupportedLanguages();
	
		foreach ($keys as $key) {
			$msgs[$key] = $this->getMessageForAllLanguages($key, $language);
		}
	
		ksort($msgs);
		$response = array("languages"=>$languages, "msgs"=>$msgs);
		return $response;
	}
538905
protected function getLanguagesInstall()
    {
        $languages = array();

        foreach ($this->language->getList() as $code => $language) {
            if ($code === 'en' || is_file($this->translation->getFile($code))) {
                $languages[$code] = $language;
            }
        }

        return $languages;
    }
1260036
public function getErrorMessages() {
        $messages = array();
        
        foreach($this->entries as $entry) {
            if($entry->isError()) {
                $messages[] = $entry->getMessage();
            }
        }
        
        return $messages;
    }
974993
public function getAcceptLanguages(): array
    {
        $ls = [];

        if ($value = $this->getLine('Accept-Language')) {
            if (\strpos($value, ';')) {
                [$value,] = \explode(';', $value, 2);
            }

            $value = \str_replace(' ', '', $value);
            $ls    = \explode(',', $value);
        }

        return $ls;
    }
282750
protected function getLangFiles()
    {
        if (static::$cache_lang_files) {
            return static::$cache_lang_files;
        }

        $locales = [];
        foreach ($this->getLangDirs() as $langPath) {
            $langFiles = scandir($langPath);
            foreach ($langFiles as $langFile) {
                $locale = pathinfo($langFile, PATHINFO_FILENAME);
                $ext = pathinfo($langFile, PATHINFO_EXTENSION);
                if ($locale && $ext === 'yml') {
                    $locales[$locale] = $locale;
                }
            }
        }
        ksort($locales);
        static::$cache_lang_files = $locales;
        return $locales;
    }
1089994
public function all(): LanguageData
    {
        $json = $this->client->performApiCallWithJsonResponse('get', '/languages');
        return ResponseHandler::create($json, ResponseHandler::METHOD_LANGUAGES)->handle();
    }
121270
public static function getAcceptLanguage(): array
    {
        if (!self::$language) {
            // get header from request
            self::$language = self::parseAcceptHeader(self::getHeader('Accept-Language'));
        }
        return self::$language;
    }
1269065
public function getMessages()
    {
        $messages = array();

        foreach ($this->getDescendants() as $widget) {
            $messages = array_merge($messages, $widget->getMessages());
        }

        return $messages;
    }
224653
public function getAllTranslations()
    {
        $this->loadTranslations($this->currentLanguage);

        if (!isset($this->translations[$this->currentLanguage])) {
            return array();
        }

        return $this->translations[$this->currentLanguage];
    }
1193857
public function availableLanguages()
    {
        $languages = array();
        $languageObjects = $this->languages();

        foreach ( $languageObjects as $languageObject )
        {
            $languages[] = $languageObject->attribute( 'locale' );
        }

        return $languages;
    }
878492
public function getAvailableLanguages()
    {
        // Event parameters prepare
        $arrayParameters = $this->makeArrayFromParameters(__METHOD__, func_get_args());

        // Sending service start event
        $arrayParameters = $this->sendEvent('melisengine_service_get_available_languages_start', $arrayParameters);

        // Service implementation start
        $langTable = $this->getServiceLocator()->get('MelisEngineTableCmsLang');
        $results = $langTable->fetchAll()->toArray();
        // Service implementation end

        // Adding results to parameters for events treatment if needed
        $arrayParameters['results'] = $results;
        // Sending service end event
        $arrayParameters = $this->sendEvent('melisengine_service_get_available_languages_end', $arrayParameters);

        return $arrayParameters['results'];
    }
704620
private function getLanguages()
    {
        $directories = glob($this->basePath.'/*', GLOB_ONLYDIR);

        $languages = array_map(function ($dir) {
            $name = basename($dir);

            return in_array($name, $this->excluded, true) ? null : $name;
        }, $directories);

        return array_filter($languages);
    }