Twig/UiExtension.php
public function renderLocaleSwitcher($attributes = [])
    {
        // TODO Check if this is a (esi) sub request, as this must never be used in a esi fragment.
        if (null === $request = $this->requestStack->getCurrentRequest()) {
            return '';
        }

        if (!array_key_exists('class', $attributes)) {
            $attributes['class'] = 'list-inline locale-switcher';
        }

        return $this->controlsTemplate->renderBlock('locale_switcher', [
            'locales' => $this->config['locales'],
            'request' => $request,
            'attr' => $attributes,
        ]);
    }
public function renderLocaleSwitcher($attributes = [])
    {
        // TODO Check if this is a (esi) sub request, as this must never be used in a esi fragment.
        if (null === $request = $this->requestStack->getCurrentRequest()) {
            return '';
        }

        if (!array_key_exists('class', $attributes)) {
            $attributes['class'] = 'list-inline locale-switcher';
        }

        return $this->controlsTemplate->renderBlock('locale_switcher', [
            'locales' => $this->config['locales'],
            'request' => $request,
            'attr' => $attributes,
        ]);
    }
Renders the locale switcher.

@param array $attributes
@return string