Returns an array of history objects grouped by locales

@param Translation $translation

@return array
490006
public function getHistory(Translation $translation)
    {
        $ordered = [];
        $histories = $this->getUnorderedHistory($translation);

        /** @var History $history */
        foreach ($histories as $history) {
            $ordered[$history->getLocale()][] = $history;
        }

        return $ordered;
    }
50587
public function filter($translations)
    {
        $cleanedTranslations = array();

        foreach ($translations as $pluginName => $pluginTranslations) {

            if (empty($this->baseTranslations[$pluginName])) {
                $this->filteredData[$pluginName] = $pluginTranslations;
                continue;
            }

            foreach ($pluginTranslations as $key => $translation) {
                if (isset($this->baseTranslations[$pluginName][$key])) {
                    $cleanedTranslations[$pluginName][$key] = $translation;
                }
            }

            if (!empty($cleanedTranslations[$pluginName])) {
                $diff = array_diff($translations[$pluginName], $cleanedTranslations[$pluginName]);
            } else {
                $diff = $translations[$pluginName];
            }
            if (!empty($diff)) {
                $this->filteredData[$pluginName] = $diff;
            }
        }

        return $cleanedTranslations;
    }
756616
public function getAll( $domain )
	{
		$messages = array();

		foreach( $this->_getTranslations( $domain ) as $object ) {
			$messages = $messages + $object->getMessages();
		}

		return $messages;
	}
1256919
public function getHistoryTranslate($localesForm)
    {
        $historicals = array();
        foreach (array_keys($localesForm) as $key) {
            $historicals = $this->getTranslateService()->getHistory($historicals, $key);
        }

        return $historicals;
    }
619993
protected function getTranslationsStats(Translations $translations, DateTime $defaultUpdatedOn)
    {
        $result = null;
        foreach ($translations as $translation) {
            if ($translation->hasTranslation()) {
                $result = [
                    'version' => '',
                    'updatedOn' => $defaultUpdatedOn,
                ];
                break;
            }
        }
        if ($result !== null) {
            $h = $translations->getHeader('Project-Id-Version');
            if ($h && preg_match('/\s([\S]*\d[\S]*)$/', $h, $m)) {
                $result['version'] = $m[1];
            }
            $h = $translations->getHeader('PO-Revision-Date');
            if ($h) {
                try {
                    $result['updatedOn'] = new DateTime($h);
                } catch (Exception $x) {
                } catch (Throwable $x) {
                }
            }
        }

        return $result;
    }
802790
protected function getHistoryUrls(
        ResourceLocatorStrategyInterface $resourceLocatorStrategy,
        $uuid,
        $webspaceKey,
        $locale
    ) {
        $historyUrls = [];
        foreach ($resourceLocatorStrategy->loadHistoryByContentUuid($uuid, $webspaceKey, $locale) as $history) {
            $historyUrls = array_merge(
                $this->webspaceManager->findUrlsByResourceLocator(
                    $history->getResourceLocator(),
                    $this->environment,
                    $locale
                ),
                $historyUrls
            );
        }

        return $historyUrls;
    }
8452
public function getFallbackLocales()
    {
        if ($this->translator instanceof Translator || method_exists($this->translator, 'getFallbackLocales')) {
            return $this->translator->getFallbackLocales();
        }

        return [];
    }
161629
public function translate($key, $translation, $locale = null) {
        $locale = $this->locale($locale);

        return Lang::get($key, null, $locale);
    }
87159
private static function toArray(Translations $translations, $includeHeaders)
    {
        $messages = [];

        if ($includeHeaders) {
            $messages[''] = self::generateHeaders($translations);
        }

        foreach ($translations as $translation) {
            if ($translation->isDisabled()) {
                continue;
            }

            $messages[$translation->getOriginal()] = $translation->getTranslation();
        }

        return $messages;
    }
168309
public function getTranslations(
        array $domains = [],
        array $languages = [],
        callable $filter = null
    ) : array {
        return $this
            ->translationCollection
            ->getTranslations(
                $domains,
                $languages,
                $filter
            );
    }
7839
public function getRecursiveTranslations(&$translationsArray)
    {
        // find all possible translations
        if (!$this->getTranslations()->isEmpty()) {
            foreach ($this->getTranslations() as $translation) {
                if ($translation) {
                    // if we already meet you stop and go on with the next
                    $translationsArray[$translation->getLocale()] = $translation;
                    $translation->getRecursiveTranslations($translationsArray);
                }
            }
        }

        // find all possible originals
        if (!$this->getOriginals()->isEmpty()) {
            foreach ($this->getOriginals() as $translation) {
                // if we already meet you stop and go on with the next
                if (array_key_exists($translation->getLocale(), $translationsArray)) {
                    return;
                }
                $translationsArray[$translation->getLocale()] = $translation;
                $translation->getRecursiveTranslations($translationsArray);
            }
        }
    }
153
public static function getLocales($domain = null)
    {
        // Optionally filter by domain
        $domainObj = Domain::getByDomain($domain);
        if ($domainObj) {
            return $domainObj->getLocales();
        }

        return Locale::getCached();
    }
326996
public function getHistory(): array
    {
        $history = [];
        foreach ($this->xml->History->children() as $logEntry) {
            $log = [];
            foreach ($logEntry as $key => $val) {
                $log[lcfirst($key)] = (string) $val;
            }
            $history[] = $log;
        }

        return $history;
    }
344526
public function jabberStates($translate = false) {
        $states = $this->getSNMP()->subOidWalk(self::OID_JABBER_STATE, 12);

        if (!$translate)
            return $states;

        return $this->getSNMP()->translate($states, self::$JABBER_STATES);
    }
376585
public function addTranslation($translation)
    {
        $this->getTranslations()->set((string)$translation->getLocale(), $translation);
        $translation->setTranslatable($this);

        return $this;
    }
325199
private function getTranslations($lang) {
    if (!isset($this->translations[$lang])) {
      $messageFile = $this->localeDir."/messages_".$lang.".php";
      if (file_exists($messageFile)) {
        require_once($messageFile);
        // store for later reference
        $this->translations[$lang] = ${"messages_$lang"};
      }
      else {
        $this->translations[$lang] = [];
      }
    }
    return $this->translations[$lang];
  }
150272
private function translationToString(Translation $translation)
    {
        $values = $translation->values;
        if ($translation instanceof Translation\Plural) {
            if (current($values) === 1) {
                return $translation->singular;
            } else {
                return $translation->plural;
            }
        } else {
            return $translation->message;
        }
    }