Sitemap.php
private function addMultiLanguageItem($locations, $lastModified, $changeFrequency, $priority)
    {
        foreach ($locations as $language => $url) {
            $this->validateLocation($url);

            $this->writer->startElement('url');

            $this->writer->writeElement('loc', $url);

            if ($lastModified !== null) {
                $this->writer->writeElement('lastmod', date('c', $lastModified));
            }

            if ($changeFrequency !== null) {
                if (!in_array($changeFrequency, $this->validFrequencies, true)) {
                    throw new \InvalidArgumentException(
                        'Please specify valid changeFrequency. Valid values are: '
                        . implode(', ', $this->validFrequencies)
                        . "You have specified: {$changeFrequency}."
                    );
                }

                $this->writer->writeElement('changefreq', $changeFrequency);
            }

            if ($priority !== null) {
                if (!is_numeric($priority) || $priority < 0 || $priority > 1) {
                    throw new \InvalidArgumentException(
                        "Please specify valid priority. Valid values range from 0.0 to 1.0. You have specified: {$priority}."
                    );
                }
                $this->writer->writeElement('priority', number_format($priority, 1, '.', ','));
            }

            foreach ($locations as $hreflang => $href) {

                $this->writer->startElement('xhtml:link');
                $this->writer->startAttribute('rel');
                $this->writer->text('alternate');
                $this->writer->endAttribute();

                $this->writer->startAttribute('hreflang');
                $this->writer->text($hreflang);
                $this->writer->endAttribute();

                $this->writer->startAttribute('href');
                $this->writer->text($href);
                $this->writer->endAttribute();
                $this->writer->endElement();
            }

            $this->writer->endElement();
        }
    }
private function addMultiLanguageItem($locations, $lastModified, $changeFrequency, $priority)
    {
        foreach ($locations as $language => $url) {
            $this->validateLocation($url);

            $this->writer->startElement('url');

            $this->writer->writeElement('loc', $url);

            if ($lastModified !== null) {
                $this->writer->writeElement('lastmod', date('c', $lastModified));
            }

            if ($changeFrequency !== null) {
                if (!in_array($changeFrequency, $this->validFrequencies, true)) {
                    throw new \InvalidArgumentException(
                        'Please specify valid changeFrequency. Valid values are: '
                        . implode(', ', $this->validFrequencies)
                        . "You have specified: {$changeFrequency}."
                    );
                }

                $this->writer->writeElement('changefreq', $changeFrequency);
            }

            if ($priority !== null) {
                if (!is_numeric($priority) || $priority < 0 || $priority > 1) {
                    throw new \InvalidArgumentException(
                        "Please specify valid priority. Valid values range from 0.0 to 1.0. You have specified: {$priority}."
                    );
                }
                $this->writer->writeElement('priority', number_format($priority, 1, '.', ','));
            }

            foreach ($locations as $hreflang => $href) {

                $this->writer->startElement('xhtml:link');
                $this->writer->startAttribute('rel');
                $this->writer->text('alternate');
                $this->writer->endAttribute();

                $this->writer->startAttribute('hreflang');
                $this->writer->text($hreflang);
                $this->writer->endAttribute();

                $this->writer->startAttribute('href');
                $this->writer->text($href);
                $this->writer->endAttribute();
                $this->writer->endElement();
            }

            $this->writer->endElement();
        }
    }
Adds a multi-language item, based on multiple locations with alternate hrefs to sitemap

@param array $locations array of language => link pairs
@param integer $lastModified last modification timestamp
@param float $changeFrequency change frequency. Use one of self:: constants here
@param string $priority item's priority (0.0-1.0). Default null is equal to 0.5

@throws \InvalidArgumentException

@see addItem