Get language information of a user in Symfony

Code
<?php

use Symfony\Component\HttpFoundation\Request;

$request Request::createFromGlobals();

// Returns the preferred language
$preferredLang $request->getPreferredLanguage();

// Languages acceptable by the client browser
$languages $request->getLanguages();

dump($preferredLang$languages);
Result
^ "en_US"

^ array:2 [
0 => "en_US"
1 => "en"
]
Used Versions
PHP 8.2, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8