Initialize the catalog for the many of the locales

@param type $locales
@param type $domain
428229
protected function initCatalogsForManyLocales($locales, $domain) {
		foreach ($locales as $locale) {
			$this->initCatalogsForSingleLocale($locale, $domain);
		}
	}
799512
public function addPreinitDomain($domain) {
		$domain = (string) $domain;
		
		if (in_array($domain, $this->preinitDomains, true)) {
			return $this;
		}
		
		$this->preinitDomains[] = $domain;
		$this->preinitNeed      = true;
		
		return $this;
	}
892812
protected function initCatalog($locale, $domain) {
		if (isset($this->initializedCatalogs[$locale][$domain])) {
			return;
		}
		
		switch ($this->sectionsMode) {
			case self::SECTIONS_IGNORE:
				$this->initExact($locale, $domain);
				break;
			
			case self::SECTIONS_DOMAIN:
				$this->initManyDomains($locale, $domain);
				break;
			
			case self::SECTIONS_LOCALE:
				$this->initManyLocales($locale, $domain);
				break;
		}
		
		if (! isset($this->initializedCatalogs[$locale])) {
			$this->initializedCatalogs[$locale] = [];
		}

		$this->initializedCatalogs[$locale][$domain] = true;
	}
207366
protected function initManyLocales($locale, $domain) {
		$source = $this->getCatalogContent($locale, $domain);
		
		if ($source !== false) {
			$locales = parse_ini_string($source, true);
			
			if ($locales === false) {
				throw new ParseError('Error has occurred while parsing INI file for the domain: "' . $domain . '"');
			}
			
			foreach ($locales as $locale => $catalog) {
				$this->catalogs = array_replace_recursive($this->catalogs, [
					$locale => [
						$domain => $catalog
					]
				]);
			}
		}

		if (! isset($this->initializedCatalogs[$locale])) {
			$this->initializedCatalogs[$locale] = [];
		}

		foreach (array_keys($locales) as $locale) {
			$this->initializedCatalogs[$locale][$domain] = true;
		}
	}
286705
public function setLocale($locale)
    {
        if (!$this->catalogueManager->has($locale)) {
            throw new LocaleException($locale);
        }

        $this->locale = $locale;
        $this->catalogueManager->load($locale);

        return $this;
    }
4096
private function getTranslationsForDomainAndIds($locale, $domain, $ids)
    {
        /** @var Translator $translator */
        $translator = $this->container->get('translator');

        $translations = [];
        foreach ($ids as $id) {
            $translations[$id] = $translator->trans($id, [], $domain, $locale);
        }

        return $translations;
    }
965023
protected function initCatalogsForSingleLocale($locale, $domain) {
		if (is_string($domain)) {
			$this->initCatalog($locale, $domain);
			return;
		}
			
		if (is_array($domain)) {
			$this->initCatalogForManyDomains($locale, $domain);
			return;
		}
		
		throw new InvalidParameter('Domain must be a string or an array');
	}
361659
public function load($resource, $locale, $domain = 'messages')
    {
        /* @var MessageCatalogue $catalogue */
        $base_catalogue = parent::load($resource, $locale, $domain);
        $catalogue = new MessageCatalogue($locale);
        $catalogue->addCatalogue($base_catalogue);

        // Process a second pass over the file to collect metadata
        $xml = simplexml_load_file($resource);
        $xml->registerXPathNamespace('xliff', 'urn:oasis:names:tc:xliff:document:1.2');
        foreach ($xml->xpath('//xliff:trans-unit') as $translation) {
            // Read the attributes
            $attributes = (array) $translation->attributes();
            $attributes = $attributes['@attributes'];
            if (!(isset($attributes['resname']) || isset($translation->source)) || !isset($translation->target)) {
                continue;
            }
            $key = isset($attributes['resname']) && $attributes['resname'] ? $attributes['resname'] : $translation->source;
            $metadata = (array) $attributes;

            // read the notes
            if (isset($translation->note)) {
                $metadata['note'] = (string) $translation->note;
            }

            $catalogue->setMetadata((string) $key, $metadata, $domain);
        }

        return $catalogue;
    }
176221
protected function initCatalogs($locale, $domain) {
		if (empty($this->resources)) {
			throw new NoResources('Resources hasn\'t been provided');
		}
		
		// Add the preinit data to the request if need
		if ($this->preinitNeed) {
			list($locale, $domain) = $this->handlePreinit($locale, $domain);
		}
		
		// Mark as initialized anyway
		$this->markAsInitialized($locale, $domain);
		
		// Try from cache
		if ($this->cache !== null) {
			$catalogsCached = $this->cache->getCatalogs($locale, $domain);
			
			if ($catalogsCached !== null) {
				$this->catalogs = array_replace_recursive($this->catalogs, $catalogsCached);
				
				// Request to the resources is still need ?
				$requestDiff = $this->calculateRequestDiff($locale, $domain, $catalogsCached);
				
				if ($requestDiff === null) {
					return;
				}
				
				list($locale, $domain) = $requestDiff;
			}
		}
		
		// Try from resources
		$catalogs = $this->getCatalogsFromResources($locale, $domain);
		
		if (! empty($catalogs)) {
			$this->catalogs = array_replace_recursive($this->catalogs, $catalogs);
			
			// Store in the cache just obtained data
			if ($this->cache !== null) {
				$this->cache->setCatalogs($catalogs);
			}
		}
	}
559332
public function load($resource, $locale, $domain = 'messages')
    {
        $catalogue = new MessageCatalogue($locale);

        foreach ($this->repository->getTranslations($locale, $domain) as $id => $translation) {
            $catalogue->set($id, $translation, $domain);
        }

        return $catalogue;
    }
976403
protected function markAsInitializedLocale($locale, $domain) {
		if (! isset($this->initializedCatalogs[$locale])) {
			$this->initializedCatalogs[$locale] = [];
		}

		if (is_string($domain)) {
			$this->initializedCatalogs[$locale][$domain] = true;
			return;
		}

		if (is_array($domain)) {
			$this->initializedCatalogs[$locale] += array_combine($domain, array_fill_keys($domain, true));
			return;
		}
	}
726411
protected function importBundleTranslationFiles(BundleInterface $bundle, $locales, $domains, $global = false)
    {
        $path = $bundle->getPath();
        if ($global) {
            $path = $this->getApplication()->getKernel()->getRootDir() . '/Resources/' . $bundle->getName() . '/translations';
            $this->output->writeln('<info>*** Importing ' . $bundle->getName() . '`s translation files from ' . $path . ' ***</info>');
        }

        $this->output->writeln(sprintf('<info># %s:</info>', $bundle->getName()));
        $finder = $this->findTranslationsFiles($path, $locales, $domains);
        $this->importTranslationFiles($finder);
    }
1338943
public void setDomains(java.util.Collection<DomainSummary> domains) {
        if (domains == null) {
            this.domains = null;
            return;
        }

        this.domains = new java.util.ArrayList<DomainSummary>(domains);
    }
775895
public function setDomain(?string $domain) : void
    {
        $this->domain = (($domain === null) ? null : strtolower($domain));
    }
311065
private function orderPages(array $pages, $locale)
    {
        $documentManager = $this->getDocumentManager();

        for ($i = 0; $i < count($pages); ++$i) {
            $document = $documentManager->find($pages[$i], $locale);
            $documentManager->reorder($document, null);
        }
    }
1024213
protected function loadDomain($domain, $locale)
    {
        $event = new LoadLanguageFileEvent($domain, $locale);

        $this->eventDispatcher->dispatch(ContaoEvents::SYSTEM_LOAD_LANGUAGE_FILE, $event);
    }
848863
protected function handlePreinit($locale, $domain) {
		if (! empty($this->preinitLocales)) {
			$locale = array_unique(array_merge(
				(array) $locale, 
				$this->preinitLocales
			));
		}

		if (! empty($this->preinitDomains)) {
			$domain = array_unique(array_merge(
				(array) $domain,
				$this->preinitDomains
			));
		}
		
		$this->preinitNeed = false;
		
		return [$locale, $domain];
	}