Retrieve article map.

@param string $sourceLanguage The source language.
@param string $targetLanguage The target language.

@return ArticleMap
184631
private function getArticleMap(string $sourceLanguage, string $targetLanguage): ArticleMap
    {
        if (!array_key_exists($key = $sourceLanguage . '->' . $targetLanguage, $this->articleMaps)) {
            return $this->articleMaps[$key] = new ArticleMap(
                $this->getPageMap($sourceLanguage, $targetLanguage),
                $this->logger
            );
        }

        return $this->articleMaps[$key];
    }
957751
public function mapContent(VersionInfo $versionInfo, $languageCode)
    {
        $contentInfo = $versionInfo->contentInfo;

        return new Content(
            [
                'id' => $contentInfo->id,
                'mainLocationId' => $contentInfo->mainLocationId,
                'name' => $versionInfo->getName($languageCode),
                'languageCode' => $languageCode,
                'innerVersionInfo' => $versionInfo,
                'site' => $this->site,
                'domainObjectMapper' => $this,
                'repository' => $this->repository,
            ]
        );
    }
477892
public function retrieve(Model $model, $source)
    {
        if ($this->isTranslated()) {
            return $model->translations->mapWithKeys(function (Model $model) {
                /** @var Taggable $model */
                return [ $model->{config('translatable.locale_key', 'locale')} => $model->tagNames() ];
            });
        }

        return $model->tagNames();
    }
416339
public function getQuestionList($language, $surveyId, $sourceSurveyId = null)
    {
        $survey = $this->getSurvey($surveyId, $sourceSurveyId);
        $model  = $survey->getModel();
        $result = [];

        foreach($model->getItemsOrdered() as $name) {
            if ($label = $model->get($name, 'label')) {
                $result[$name] = $label;
            }
        }

        if ($model->getMeta('nested', false)) {
            foreach ($model->getMeta('nestedNames') as $name) {
                // We have a nested model, add the nested questions
                $nestedModel = $model->get($name, 'model');
                foreach($nestedModel->getItemsOrdered() as $name) {
                    if ($label = $nestedModel->get($name, 'label')) {
                        $result[$name] = $label;
                    }
                }
            }
        }

        return $result;
    }
723117
public function createDictionary(
        string $name,
        string $sourceLanguage,
        string $targetLanguage,
        array $customData = []
    ): WritableDictionaryInterface {
        throw new \RuntimeException('Creating MetaModels is not supported.');
    }
730801
public function getFallbackLanguage($forLanguage = null)
    {
        if ($this->_fallbackLanguage === null) {
            $this->_fallbackLanguage = Yii::$app->sourceLanguage;
        }
        if ($forLanguage === null) {
            return $this->_fallbackLanguage;
        }
        if ($this->_fallbackLanguage === false) {
            return $forLanguage;
        }

        if (is_array($this->_fallbackLanguage)) {
            if (isset($this->_fallbackLanguage[$forLanguage])) {
                return $this->_fallbackLanguage[$forLanguage];
            }
            // check fallback de-DE -> de
            $fallbackLanguage = substr($forLanguage, 0, 2);
            if ($forLanguage !== $fallbackLanguage) {
                return $fallbackLanguage;
            }
            // when no fallback is available, use the first defined fallback
            return reset($this->_fallbackLanguage);
        }

        // check fallback de-DE -> de
        $fallbackLanguage = substr($forLanguage, 0, 2);
        if ($forLanguage !== $fallbackLanguage) {
            return $fallbackLanguage;
        }
        return $this->_fallbackLanguage;
    }
585830
public function getDictionaryForWrite(
        string $name,
        string $sourceLanguage,
        string $targetLanguage,
        array $customData = []
    ): WritableDictionaryInterface {
        $this->logger->debug('Xliff: opening writable dictionary ' . $name);
        if (!file_exists($fileName = $this->getFileNameFor($name, $sourceLanguage, $targetLanguage))) {
            throw new DictionaryNotFoundException($name, $sourceLanguage, $targetLanguage);
        }
        $dictionary = new WritableXliffDictionary($fileName);
        $dictionary->setOriginal($name);
        $this->guardLanguages($sourceLanguage, $targetLanguage, $dictionary);

        return $dictionary;
    }
202844
public function getMappedField($field, $language, $fallbackLanguage = null)
    {
        if ($this->mappedFields->containsKey($language)) {
            $mappedField = $this->mappedFields->get($language);
        } elseif ($this->mappedFields->containsKey($fallbackLanguage)) {
            $mappedField = $this->mappedFields->get($fallbackLanguage);
        } else {
            foreach ($this->mappedFields as $testMappedField) {
                if ($testMappedField->getLanguage() === $language) {
                    $mappedField = $testMappedField;
                    break;
                }
            }
            if (!isset($mappedField)) {
                foreach ($this->mappedFields as $testMappedField) {
                    if ($testMappedField->getLanguage() === $fallbackLanguage) {
                        $mappedField = $testMappedField;
                        break;
                    }
                }
            }
            if (!isset($mappedField)) {
                return null;
            }
        }

        if ($field === 'page') {
            if ($mappedField->getPage()) {
                return $mappedField->getPage();
            } else {
                $field = 'backend';
            }
        }

        if ($field === 'navigation') {
            if ($mappedField->getNavigation()) {
                return $mappedField->getNavigation();
            } else {
                $field = 'backend';
            }
        }

        if ($field === 'backend') {
            return $mappedField->getBackend();
        }

        if ($field === 'date' && $mappedField->getDate()) {
            return $mappedField->getDate();
        }

        if ($field === 'forward' && $mappedField->getForward()) {
            return json_decode($mappedField->getForward(), true);
        }

        if ($field === 'custom1' && $mappedField->getCustom1()) {
            return $mappedField->getCustom1();
        } elseif ($field === 'custom2' && $mappedField->getCustom2()) {
            return $mappedField->getCustom2();
        } elseif ($field === 'custom3' && $mappedField->getCustom3()) {
            return $mappedField->getCustom3();
        } elseif ($field === 'custom4' && $mappedField->getCustom4()) {
            return $mappedField->getCustom4();
        } elseif ($field === 'custom5' && $mappedField->getCustom5()) {
            return $mappedField->getCustom5();
        }

        return null;
    }
1139697
private function mapCollectionField($document, Field $field, $sourceTargetObject)
    {
        /** @var Collection $collection */
        $collection = $field->getValue();
        $getter = $field->getGetterName();

        if ($getter != '') {
            $collection = $this->callGetterMethod($sourceTargetObject, $getter);

            $collection = array_filter($collection, function ($value) {
                return $value !== null;
            });
        }

        $values = [];
        if (count($collection)) {
            foreach ($collection as $relatedObj) {
                if (is_object($relatedObj)) {
                    $values[] = $this->objectToDocument($relatedObj);
                } else {
                    $values[] = $relatedObj;
                }
            }

            $document->addField('_childDocuments_', $values, $field->getBoost());
        }

        return $values;
    }
1184317
public Map<String, Set<String>> getTargetLanguagesByBundle() {
        if (targetLanguagesByBundle == null) {
            assert false;
            return Collections.emptyMap();
        }
        return Collections.unmodifiableMap(targetLanguagesByBundle);
    }
462720
private function getEdgeIndex( $sourceNode, $targetNode )
	{
		for( $i=0; $i<sizeof( $this->edges ); $i++ )
		{
			$edge = $this->edges[$i];
			$isSource = $edge->getSourceNode() == $sourceNode;
			$isTarget = $edge->getTargetNode() == $targetNode;
			if( $isSource && $isTarget )
				return $i;
		}
		return -1;
	}
610136
protected function addRootNodes(\DOMDocument $dom, $targetLanguage = null)
    {
        $xliff = $dom->appendChild($dom->createElement('xliff'));
        $xliff->appendChild(new \DOMAttr('xmlns', 'urn:oasis:names:tc:xliff:document:1.2'));
        $xliff->appendChild(new \DOMAttr('version', '1.2'));

        $fileNode = $xliff->appendChild($dom->createElement('file'));
        $fileNode->appendChild(new \DOMAttr('source-language', 'en'));
        $fileNode->appendChild(new \DOMAttr('datatype', 'plaintext'));
        $fileNode->appendChild(new \DOMAttr('original', 'file.ext'));

        if (!is_null($targetLanguage)) {
            $fileNode->appendChild(new \DOMAttr('target-language', $targetLanguage));
        }

        $bodyNode =  $fileNode->appendChild($dom->createElement('body'));

        return $bodyNode;
    }
270824
protected function _getLanguageMap($iLang, $blAdmin = null)
    {
        $blAdmin = isset($blAdmin) ? $blAdmin : $this->isAdmin();
        $sKey = $iLang . ((int) $blAdmin);
        if (!isset($this->_aLangMap[$sKey])) {
            $this->_aLangMap[$sKey] = [];
            $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();

            $sMapFile = '';
            $sParentMapFile = $myConfig->getAppDir() . '/views/' . ($blAdmin ? 'admin' : $myConfig->getConfigParam("sTheme")) . '/' . \OxidEsales\Eshop\Core\Registry::getLang()->getLanguageAbbr($iLang) . '/map.php';
            $sCustomThemeMapFile = $myConfig->getAppDir() . '/views/' . ($blAdmin ? 'admin' : $myConfig->getConfigParam("sCustomTheme")) . '/' . \OxidEsales\Eshop\Core\Registry::getLang()->getLanguageAbbr($iLang) . '/map.php';

            if (file_exists($sCustomThemeMapFile) && is_readable($sCustomThemeMapFile)) {
                $sMapFile = $sCustomThemeMapFile;
            } elseif (file_exists($sParentMapFile) && is_readable($sParentMapFile)) {
                $sMapFile = $sParentMapFile;
            }

            if ($sMapFile) {
                include $sMapFile;
                $this->_aLangMap[$sKey] = $aMap;
            }
        }

        return $this->_aLangMap[$sKey];
    }
372889
public function createNewLanguageContent($contentSource, $language)
    {
        $content = $this->cloneContent($contentSource);
        $content->setLanguage($language);
        if (false === $content->getStatus()->isOutOfWorkflow()) {
            $translationStatus = $this->statusRepository->findOneByTranslationState();
            $content->setStatus($translationStatus);
        }

        return $content;
    }
1079242
public function createLanguageSourceDataProvider($languageSources)
    {
        $data = [];
        foreach ($languageSources as $category => $messages) {
            foreach ($messages as $message => $boolean) {
                $data[] = [
                    'category' => $category,
                    'message' => $message,
                ];
            }
        }

        return new ArrayDataProvider([
            'allModels' => $data,
            'pagination' => false,
        ]);
    }
1013876
public function map($sourcePath, $targetPath)
  {
    if (file_exists($sourcePath)) {
      $items = array();
      if (is_file($sourcePath)) {
        $items[$targetPath] = $sourcePath;
      } elseif (is_dir($sourcePath)) {
        $finder = new Finder\Finder();
        foreach ($finder->in($sourcePath)->files() as $file) {
          /* @var $file Finder\SplFileInfo */
          $fileTargetPath = $targetPath . "/" . $file->getRelativePathname();
          $items[$fileTargetPath] = $file->getPathname();
        }
      }

      foreach ($items as $target => $source) {
        $formulae = new AssetFormulae();
        $formulae->setInputs(
          array($source)
        );
        $formulae->setOptions(
          array("output" => $target)
        );

        $this->append($formulae);
      }
    }
  }
109964
public function listGlobalURLAliases($languageCode = null, $offset = 0, $limit = -1)
    {
        $data = $this->gateway->listGlobalEntries($languageCode, $offset, $limit);
        foreach ($data as &$entry) {
            $entry['raw_path_data'] = $this->gateway->loadPathData($entry['id']);
        }

        return $this->mapper->extractUrlAliasListFromData($data);
    }