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();
        }
    }